Fixing tibble column incompatible size error for tidyverse

Dear RStudio Community,

I am very new to RStudio and to tidyverse, so please pardon my ignorance. I am trying to prepare a set of plays for computational analysis (including tf-idf) but am running into difficulties from the get-go. I tried to follow Text Mining with R, using a text file I have prepared, but when I type the following:

baillie.v <- scan("14 plays from Collected stripped intervening metadata.txt", what="character", sep= "\n")
text_df <- tibble(line = 1:4, text = baillie.v)

I receive this error:

Error: Tibble columns must have compatible sizes.

  • Size 4: Existing data.
  • Size 43934: Column text.
    i Only values of size one are recycled.

Having looked through similar topics, I see that "tibble does not automatically recycle vectors to match length, hence the error." But I do not know how to apply the fix suggested there to my variable.

I would appreciate any help.

Sincerely,

Steve Newman

Hi, I'll guess that line is of length 4, while text is of length 43,934.

What do you want to do?

What happens when you type: text_df <- tibble(text = baillie.v)

Better things, it looks like! (See below.)
Thank you for your help. Now I can move on working through these exercises.

Sincerely,
Steve
text_df <- tibble(text = baillie.v)

text_df

A tibble: 43,934 x 1

text

1 _____________________________________________~
2 ORRA: A TRAGEDY, IN FIVE ACTS.
3 PERSONS OF THE DRAMA. MEN Hughobert , Count o~
4 Glottenbal , his son.
5 Theobald of Falkenstein , a nobleman of reduc~
6 Rudigere , a knight, and commander of one of ~
7 Hartman , friend of Theobald , and Banneret o~
8 Urston , a confessor.
9 Franko , chief of a band of outlaws.
10 Maurice , an agent of Rudigere ' s.

... with 43,924 more rows

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.