哪个读取或扫描函数用于快速存储来自 excel 的参数转储
which read or scan function to be used to quickly store a dump of parameters from excel
我有一个 excel 文件,在使用普通 read.csv(filename)
阅读后,其摘录如下所示。已复制粘贴导入数据一列的前 16 行。
[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
注意:我用 noquote()
去掉了引号。
我需要的是将所有参数值(上面列表中以逗号分隔的单个单词)拉入一个向量(字符向量)。我需要一种干净优雅的方式来做到这一点。我知道使用函数 str_split
会严重破坏数据的混乱方式。见下文。
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"
.....
所有单词都需要在一个整齐的字符向量中。我相信有一种直接的方法可以做到这一点。如果你能给我一个提示,我将不胜感激。
我想你在找:
unlist(strsplit(y,","))
我有一个 excel 文件,在使用普通 read.csv(filename)
阅读后,其摘录如下所示。已复制粘贴导入数据一列的前 16 行。
[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
注意:我用 noquote()
去掉了引号。
我需要的是将所有参数值(上面列表中以逗号分隔的单个单词)拉入一个向量(字符向量)。我需要一种干净优雅的方式来做到这一点。我知道使用函数 str_split
会严重破坏数据的混乱方式。见下文。
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"
.....
所有单词都需要在一个整齐的字符向量中。我相信有一种直接的方法可以做到这一点。如果你能给我一个提示,我将不胜感激。
我想你在找:
unlist(strsplit(y,","))