Skip to content

word() Ignore error when end = parameter is greater than the size of the string #112

@diegocgaona

Description

@diegocgaona

Hi,

Very useful package!

I'm trying to use the word() with Facebook posts text, to put then on a table. The problem is that I don't know how much words the string contain.
When I use the command:
fb_sent_comments_agg$post_text <- word(fb_sent_comments_agg$post_text, end = 5)

I receive the error:
Error in word[loc, "end"] : subscript out of bounds

Could be possible to do something when the string have less than 5 words? For example, end = works like:
if more than n words, cut the string after n, else don't cut the string.

Thanks!!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions