How to read data from excel into R when entries in excel are semicolon
separated vectors
Suppose I have a csv file in excel as a table that looks something like this
ID | variable1 | variable2 | variable3 | Date
_____________________________________
1 | 1;2;3;4;9 | 3;0;0;0 | 1;3;4;2;1 | 8/20/2013 11:50|
_____________________________________
2 | 1;4;9 | 3;2;0;2;0 | 3;0;2;0 | 8/10/2013 1:50|
_____________________________________
..
..
..
_____________________________________
n | 2;3;0;0;1 | ...
meaning the first three rows (out of hundreds) of the csv file looks like
uID,variable1,variable2,variable3,date
1, 1;2;3;4;9, 3;0;0;0, 1;3;4;2;1, 8/20/2013 11:50
2, 1;4;9, 3;2;0;2;0, 3;0;2;0, 8/10/2013 1:50
I have looked at the help files for read.csv, read.xls but still haven't
found an option that works for this complicated csv file.
I imagine the best way to analyze the data would be to create a list of
user IDs (column 1) where each user ID was a list of variables (columns
2-date), but I am stumped as to how to get this data into R. So I think
the desired format would look something like this
usr[[1]][[1]] = 1
usr[[1]][[2]] = c(1,2,3,4,9)
usr[[1]][[3]] = c(3,0,0,0)
usr[[2]][[1]] = 2 #the usrID
No comments:
Post a Comment