I am trying to import a .csv file into R with:
mydata <- read.table("c:/data.csv", header=TRUE, sep=",", row.names="id")
But keep getting:
Error in data[[rowvar]] : attempt to select less than one element
The .csv file looks like:
Title1,Title2,Title3
1,2,3
4,5,6
7,8,9
Any help would be much appreciated!
mydata <- read.csv("c:/mydata.csv")
Use the read.csv function instead. It auto popoulates the column headers based on the values in the first row.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With