So I have data being processed in Python that I'm outputting as a .csv file. I would like R to be able to read the .csv file in such a way that it turns it into a dataframe in which some of the columns are actually vectors.
Is this even possible and how would I format a .csv so that this could happen? Thanks!
First, vectors are simply a sequence of data elements. And data frames are lists of equal length vectors.
Hence, you can easily reference each column of a data frame as a vector.
df <- read.csv('C:\\Path\\To\\DataFile.csv')
v1 <- df[[1]] # by column number
v2 <- df[["col1"]] # by column name
v3 <- df$col1 # by column name
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