Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 RStudio,并且有一个话语变量和一个带有音节数的音节变量。每个包含“t-shirt”的话语都需要多一个音节。(自动 qdap syllable_sum 给“t-shirt”它1(它需要2))。
一个例子:黄色T恤有3个(它需要4个音节)。
我不想写所有我尝试过但没有奏效的东西。我找到了这方面的例子,但不是我可以使用的 R。
你需要魔力grepl{}
grepl{}
install.packages("grepl") library(grepl) mydf$syllables <- syllable_sum(mydf$label) mydf$syllables <- ifelse(grepl("t-shirt", mydf$label), mydf$syllables+1, mydf$syllables) mydf