Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Can I place a .tsv file within a vectr in R?

I want to read a tsv file with a lot of numbers. Is it possible to put it inside a vector?
Like, now I can manually place numbers in my vector, but can I just put the file inside the vector, so i takes all the values from the file?

my_vector <- c(1, 3, 7, 2, 6)

My idea was that I could write something like

my_vector <- c("my_file.tsv")

But it doesn’t work. Is there a way to do it?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You could use:

unname(unlist(read.table("temp.tsv", sep="\t")))
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading