R read data from csv files

Reading data from csv files is very useful as csv file is a standard output of many programs. In R, you can read csv file in one line:

df <- read.csv("/path/to/file.txt", row.names=1,head=FALSE, sep=",")

The code above specifies the first column is just a name by using row.names=1. By using head=FALSE, it says there is no head of the data, i.e., all rows are data. We can also specify what to use to separate each line. In this case, we use “,”.

Leave a Comment