I'm new to R so I apologize if my terminology is incorrect here. I have a .csv file that has two rows with irrelevant information (the date, and another global header) and then has the relevant data starting at row 3 with all the column headers. I have figured out that the code
my.files <- list.files()
file <- readLines(my.files[1])
temp2 <- data.frame((file[-c(1,2)]))
removes the first two rows of data and stores the remaining rows in a data frame, however, the data frame that is saved only has one column with each of the intended columns separated by a comma: "Frame ID,Delta Time, Head Pos X, Head Pos Y, Head Pos Z..."
The rows beneath have the correct responses, but are similarly squished into a single column separated by commas.
How do I either 1) rewrite the above code to end with a matrix that is missing the first two rows, or 2) separate a single column that is comma delimited into multiple columns within a data frame?
I have seen the strsplit()
function but have not been able to apply it appropriately.