Reputation: 1
I have a set of csv data that is saved in matrix format attached image is an example of the matrix I would like to load the data into R and have it stored as a data frame with x$Year,x$Death,x$ASMR. How would I be able to do that?
Thanks!
CS
Upvotes: 0
Views: 423
Reputation: 561
I think you're just looking for read.csv()
and then change the colnames
. I am assuming your file is separated by commas.
x <- read.csv('matrix.csv', sep=',', header=T)
colnames(x) <- c('Year', 'Death', 'ASMR')
Upvotes: 2