Quotes help make search much faster. Example: "Practice Makes Perfect"

Tuesday, October 22, 2013

In R, how do you read the contents of a .txt file into a data frame?


Answer:

someDataframe <- read.table("someFile.txt", sep="\t", header=TRUE)

//in this example, the columns in the .txt file are separated by tabs (tab delimited)
//header = TRUE indicates that the first row in the .txt file represents the headers of the data frame
//change this to FALSE if the first row already represents raw data

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts