I can't use unnest tokens properly when importing from excel

32 Views Asked by At

I'm a brand new r programmer and I'm doing an unguided assignment trying to start text mining / sentiment analysis. I'm supposed to get text from an excel file (looks like this)

I do some filtering and then create a dataframe like this: text_df3 = tibble(line = 1:363, text = chat_log_4272010)

So then I have a dataframe in my console created here

The problem is every tutorial for text mining starts to use the unnest token function but they always just create their own dataframe within r so that it's just one column called "text".

They just easily carry out the unnest tokens using this text_df3 %>% unnest_tokens(word, text)

The problem is my column in my dataframe is called text$Chat as "Chat" was the column name of the excel file.

I can't put a $ operator in my unnest tokens argument (to make it like text$Chat) and I can't just run it as they have because "text" I guess isn't specific enough. I always get: Error in is_corpus_df(corpus) : ncol(corpus) >= 2 is not TRUE if I run it with just "text" as an argument.

Please help with this relatively simple issue. Very frustrated as I've spent all afternoon with no progress on the assignment.

0

There are 0 best solutions below