How to read data from a text file in R?

r

#1

Hi everyone,

I have a data set that is given in a .txt file. I am not able to find a means to manipulate data from it directly. Please suggest a method to read a text file into R. Can I convert it into .csv format or is it possible to manipulate data directly by reading it from a .txt file? If yes, please suggest some resource or piece of code.

Any help would be appreciated!


#2

you can use read.table command in R. Below is the example how you can read text file.
ex:
a <- read.table("…/test.txt", sep = “\t”)


#3

Thank you @saurabh090909