I have an excel file, an extract of which looks like this, after reading it using a plain read.csv(filename)
. Have copy-pasted first 16 lines of one column of the imported data.
[1] UserName, UserPassword, AppVersion, UserId, UUID, AppId, Latitude, Longitude
[2] UserId, UUID
[3] UserId, UUID
[4] UserId, UUID
[5] UserId, UUID
[6] UserId, UUID
[7] SessionId, StatusId, UserId, UUID
[8] RoomId, Rows, Columns, SeatsRemoved, UserId, UUID
[9] SessionId, UserId, UUID
[10] QueryId, UserId, UUID
[11] SessionId, SeatIdList, StudentIdList, StatusId, UserId, UUID
[12] RoomId, UserId, UUID
[13] SessionId, UserId, UUID
[14] SessionId, UserId, UUID
[15] SessionId, UserId, UUID
[16] MessageType, MessageContent, SenderId, ReceiverId
Note: I used noquote()
to strip the quotes out.
What I need is to pull in all parameter values (which are comma-separated single words in the list above) into one vector (char vector). I need a clean and elegant way to do this. I know of messy ways by using the function str_split
which messes with the data badly. See below.
str_split(y,",")
[[1]] [1] "UserName" " UserPassword" " AppVersion" " UserId" " UUID" " AppId" [7] " Latitude" " Longitude"
[[2]] [1] "UserId" " UUID"
[[3]] [1] "UserId" " UUID"
[[4]] [1] "UserId" " UUID"
[[5]] [1] "UserId" " UUID"
[[6]] [1] "UserId" " UUID"
[[7]] [1] "SessionId" " StatusId" " UserId" " UUID"
[[8]] [1] "RoomId" " Rows" " Columns" " SeatsRemoved" " UserId" " UUID"
.....
All words are needed in one neat character vector. I am sure there is a straightforward way to do this. Appreciate if you can just provide me with a hint.