我的数据框中有超过一千行。其中一列应该只包含一个单词。我想小写这一列:
df$precedingWord <- tolower(df$precedingWord)
但令人惊讶的是,我收到了错误
Error in tolower(df$precedingWord) :
invalid input '/home/nobackup/SONAR/COMPACT/WR-P-E-L/WR-P-E-L0000106.data.ids.xml: Ik zeg jij hebt goede ogen í ½í¸³RT @IMoonen Ik tel 16 schepen voor de kust, dat mag je gerust een #' in 'utf8towcs'
从此我收集到一个特定的行,df $ precedingWord不包含单个单词,但不止一个句子,即 / home / nobackup / SONAR / COMPACT / WR-PEL / WR-PE -L0000106.data.ids.xml:Ik zeg jij hebt goedeogení½í¸³TT@IMoonen Ik tel 16 schepen voor de kust,dat mag je gerust een#。
现在要调试它,我想知道抛出的句子的行ID。我怎么能找到这个?
答案 0 :(得分:1)
使用grep
搜索字符串:
x <- c("a",
'/home/nobackup/SONAR/COMPACT/WR-P-E-L/WR-P-E-L0000106.data.ids.xml: Ik zeg jij hebt goede ogen í ½í¸³RT @IMoonen Ik tel 16 schepen voor de kust, dat mag je gerust een #')
grep("/home/nobackup/SONAR/COMPACT/WR-P-E-L/WR-P-E-L0000106.data.ids.xml:",
x, fixed = TRUE)
#[1] 2