Thank you, Petr.
I found your guidance very helpful!
JJ
________________________________
From: PIKAL Petr <petr.pikal at precheza.cz>
Sent: Wednesday, May 29, 2019 12:31:31 AM
To: Jianjun Wang; r-help at R-project.org
Subject: RE: Error in using tokens script
Hi.
Most probably SMSSpamCollection$Message is not character, corpus or tokens
object (which error message politely suggests).
You need to change it to be correct mode
functions ?str, ?mode, ?typeof
to see your objects.
And maybe also R intro chapter about objects and its differences.
Cheers
Petr
> -----Original Message-----
> From: R-help <r-help-bounces at r-project.org> On Behalf Of Jianjun
Wang
> Sent: Tuesday, May 28, 2019 6:51 PM
> To: r-help at R-project.org
> Subject: [R] Error in using tokens script
>
> Hi, Colleagues.
>
> As shown at the bottom, I was able to obtain information from a column
> (named "Message") of a text data (named
"SMSSpamCollection" (i.e.,
> SMSSpamCollection$Message[44]). But when I ran SMSSpamCollection.token
> <-tokens(SMSSpamCollection$Message, what="word",
> + remove_url = TRUE,
> + remove_numbers= TRUE, remove_punct=
TRUE,
> + remove_symbols= TRUE, remove_hyphens>
+ TRUE)
> The feedback was
> Error in tokens.default(SMSSpamCollection$Message, what = "word",
> remove_url = TRUE, :
> tokens() only works on character, corpus, tokens objects.
>
> I would appreciate some guidance to fix the error message!
>
> Thank you.
>
> JJ
>
> > SMSSpamCollection$Message[44]
> [1] Great! I hope you like your man well endowed. I am <#>
inches...
> 3026 Levels: 'An Amazing Quote'' - Sometimes in life its
difficult to decide
> whats wrong!! a lie that brings a smile or the truth that brings a tear....
...
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>
https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_r-2Dhelp&d=DwIGaQ&c=8Ipd-S27WuaKn7LZs55QTnbDbMQSs_VN5Yh9G3ue5PM&r=6YMmmhzICZ4OUwhDfmC3QQ&m=LUpJDuot2AUCyWEmCgVRCoXYKjSYCu7ckyeK7upUq4I&s=0dIIMZFHah0wvGMbe5KAFMvjfgT_oKYeOmsL5pqGNA8&e>
PLEASE do read the posting guide
https://urldefense.proofpoint.com/v2/url?u=http-3A__www.R-2Dproject.org_posting-2D&d=DwIGaQ&c=8Ipd-S27WuaKn7LZs55QTnbDbMQSs_VN5Yh9G3ue5PM&r=6YMmmhzICZ4OUwhDfmC3QQ&m=LUpJDuot2AUCyWEmCgVRCoXYKjSYCu7ckyeK7upUq4I&s=OLGbSDf02XONRvcC1XNalDpnrdpIYaI1KBF2MmJvWag&e>
guide.html
> and provide commented, minimal, self-contained, reproducible code.
Osobn? ?daje: Informace o zpracov?n? a ochran? osobn?ch ?daj? obchodn?ch
partner? PRECHEZA a.s. jsou zve?ejn?ny na:
https://urldefense.proofpoint.com/v2/url?u=https-3A__www.precheza.cz_zasady-2Dochrany-2Dosobnich-2Dudaju_&d=DwIGaQ&c=8Ipd-S27WuaKn7LZs55QTnbDbMQSs_VN5Yh9G3ue5PM&r=6YMmmhzICZ4OUwhDfmC3QQ&m=LUpJDuot2AUCyWEmCgVRCoXYKjSYCu7ckyeK7upUq4I&s=8cMbsv-ZkxDvNeiZvk8D0orcV_Y4h5NB8FJxHN_CjqM&e=
| Information about processing and protection of business partner?s personal
data are available on website:
https://urldefense.proofpoint.com/v2/url?u=https-3A__www.precheza.cz_en_personal-2Ddata-2Dprotection-2Dprinciples_&d=DwIGaQ&c=8Ipd-S27WuaKn7LZs55QTnbDbMQSs_VN5Yh9G3ue5PM&r=6YMmmhzICZ4OUwhDfmC3QQ&m=LUpJDuot2AUCyWEmCgVRCoXYKjSYCu7ckyeK7upUq4I&s=MF2IFhsgZJkQV61u-wtP4mAr1B_XsYNf9neVXpv9WcU&eD?v?rnost:
Tento e-mail a jak?koliv k n?mu p?ipojen? dokumenty jsou d?v?rn? a podl?haj?
tomuto pr?vn? z?vazn?mu prohl?en? o vylou?en? odpov?dnosti:
https://urldefense.proofpoint.com/v2/url?u=https-3A__www.precheza.cz_01-2Ddovetek_&d=DwIGaQ&c=8Ipd-S27WuaKn7LZs55QTnbDbMQSs_VN5Yh9G3ue5PM&r=6YMmmhzICZ4OUwhDfmC3QQ&m=LUpJDuot2AUCyWEmCgVRCoXYKjSYCu7ckyeK7upUq4I&s=trxOYmiq7ocP9bxSqEtga9MtXWjQGgRK8sMacrZq2wk&e=
| This email and any documents attached to it may be confidential and are
subject to the legally binding disclaimer:
https://urldefense.proofpoint.com/v2/url?u=https-3A__www.precheza.cz_en_01-2Ddisclaimer_&d=DwIGaQ&c=8Ipd-S27WuaKn7LZs55QTnbDbMQSs_VN5Yh9G3ue5PM&r=6YMmmhzICZ4OUwhDfmC3QQ&m=LUpJDuot2AUCyWEmCgVRCoXYKjSYCu7ckyeK7upUq4I&s=oLigFdPzgIUCL2MmZB7ZN4mZWgKL07CV8nA9IJ5FoHU&e
[[alternative HTML version deleted]]