Getting .txt Data into R
- If your file ends with .txt, then you can use read.table instead. As an additional argument (which is separated from the path name with a comma), you may need to specify that the cells of your table are separated by tabs. To do this, add the sep="\t" argument (\t is "computer-talk" for tab). Also, your file may have a header, meaning the first row of your file might contain the names of the columns. By default, read.csv assumes this, but for read.table you'll need to make that explicit so R knows what to do with them. You can add this using the header=TRUE argument. So the final command might look like:
-
For MAC
- menu<-read.table("/Users/joeystanley/Desktop/menu.csv", sep="\t", header=TRUE)
-
For Windows/PC
- menu<-read.table("C:\\Users\\joeystanley\\Desktop\\menu.txt", sep="\t", header=TRUE)