Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

Reply
Syndicate_Admin
Administrator
Administrator

Wordcloud Script R

Hi. When I run the R script for word cloud I get this:

Error Message:
Error del script R.
Error in `[.data.frame`(data, , 1:2) : undefined columns selected
Calls: wordcloud2 -> [ -> [.data.frame

the dataset contains one word per row

library(wordcloud2)
wordcloud2(dataset, size = 2, color = "random-light", backgroundColor = "grey")
wordcloud2(dataset, size = 2, minRotation = -pi/6, maxRotation = -pi/6, rotateRatio = 1)

Any suggestions please?

Thank you very much

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Syndicate_Admin ,

 

Error in `[.data.frame`(data, , 1:2) : undefined columns selected

According to your error message, I think your error should be casued by Data[...,...] part. As far as I know, data function should look like as below.

data[rows you want, columns you want]

I think you only want to return first two columns based on your code. Please try below code.

data[data,1:2]

For reference:

How to Handle “undefined columns selected” in R

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @Syndicate_Admin ,

 

Error in `[.data.frame`(data, , 1:2) : undefined columns selected

According to your error message, I think your error should be casued by Data[...,...] part. As far as I know, data function should look like as below.

data[rows you want, columns you want]

I think you only want to return first two columns based on your code. Please try below code.

data[data,1:2]

For reference:

How to Handle “undefined columns selected” in R

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.