Reputation: 1642
I want to read as text only one specific column of my dataframe, i.e. the 3rd column C, and create a word cloud. Let df=
A B C
1 2 sheep
2 2 sheep
3 4 goat
4 5 camel
5 2 camel
6 1 camel
I am try to readLines from readLines(df$C)
but I get the following error:
Error in readLines(df$C) :
'con' is not a connection
Upvotes: 0
Views: 35
Reputation: 14902
df <- read.table(textConnection("A B C
1 2 sheep
2 2 sheep
3 4 goat
4 5 camel
5 2 camel
6 1 camel"), header = TRUE, stringsAsFactors = FALSE)
library("quanteda")
## Package version: 1.3.0
corpus(df, text_field = "C") %>%
dfm() %>%
textplot_wordcloud(min_count = 1)
Upvotes: 2