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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Ski900
Helper II
Helper II

Issues publishing barplot R visual, names.arg not displaying.

I am trying to publish a barplot that shows the top 10 words by frequency. The issue I am having is the words attached below each bar do now show when published, but do show in Power BI. The only package I am using is tm, which is on the supported list of R packages. I am not going to included any tm_map cleaning of the dataset because it does not seem necessary, but I will provide if requested. The sample data provided has already been converted into a data.frame. Thanks in advance for the help!

 

Sample data (top 20)

 

		 word freq
account       account  333
child           child   64
date             date   47
family         family   44
email           email   43
access         access   39
birth           birth   38
time             time   38
change         change   37
adult           adult   34
prod1           prod1   32
company       company   28
permission permission   27
card             card   26
years           years   26
problem       problem   25
log               log   21
atari           atari   21
son               son   21
put               put   20

Code

# ATTEMPT 1
tdm <- as.matrix(tdm)
freq.df <- data.frame(Word = rownames(tdm),
                 Freq = rowSums(tdm),
                 row.names = NULL)

ordered.results <- with(freq.df, freq.df[order(-Freq),])

bp <- barplot(ordered.results$Freq[1:10],
        las = 2,
        col = '#015C55',
        names.arg = ordered.results$Word[1:10],
        cex.names = .9
        )
text(bp, ordered.results$Freq[1:10], ordered.results$Freq[1:10], cex=.8,pos=1, offset = .2,col = '#ffffff')

# ATTEMPT 2
m <- as.matrix(tdm)
v <- sort(rowSums(m), decreasing = TRUE)
d <- data.frame(word = names(v), freq = v)
head(d,20)

bp1 <- barplot(
  d[1:10,]$freq, las = 2,
  names.arg = d[1:10,]$word,
  col = '#015C55')
text(bp1, d[1:10,]$freq, d[1:10,]$freq, cex=.8,pos=1, offset = .2,col = '#ffffff')
# I added below text() field to see if it would publish with the names inside the bars, but
# they did not display once published. I'm not sure if this means there's an issue with publishing
# characters
text(bp1, d[1:10,]$word, d[1:10,]$word, cex=.8,pos=3,col = '#ffffff')

Desired ResultsDesired ResultsPublished ResultsPublished Results

 

 

3 REPLIES 3
v-shex-msft
Community Support
Community Support

Hi @Ski900,

 

I'd like to suggest you take a look at limitations about r visual:

Creating R visuals in the Power BI service

Known Limitations

R visuals in the Power BI service have a few limitations:

  • R visuals support is limited to the packages identified on the following page . There currently is no support for custom packages.
  • Data size limitations – data used by the R visual for plotting is limited to 150,000 rows. If more than 150,000 rows are selected, only the top 150,000 rows are used and a message is displayed on the image.
  • Calculation time limitation – if an R visual calculation exceeds 60 seconds the script times out, resulting in an error.
  • R visuals are refreshed upon data updates, filtering, and highlighting. However, the image itself is not interactive and does not support tool tips.
  • R visuals respond to highlighting other visuals, but you cannot click on elements in the R visual in order to cross filter other elements.
  • R visuals are currently not supported for the Time data type. Please use Date/Time instead.
  • R Visuals do not display when using Publish to web.
  • R visuals currently do not print with dashboard and reports printing
  • R visuals are currently not supported in the DirectQuery mode of Analysis Services
  • Chinese, Japanese and Korean fonts require all of the additional following steps to work properly in the Power BI service:

Regards,
Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Thank you for the in depth response! I have a few questions though.

 

1.) When you say there is no support for custom packages, does this also include the packages listed here? The package I used is listed here which is why I ask. I do not actually do the visualization with this package, it is simply used to build a corpus. On the other hand, the data frame is built with it. Also, I use barplot() which is a base function. I had previously created a subset based on frequecy and the words displayed at that time. 

2.) Just for confirmation, when you say publish to the web, you are referring to publishing a report to msit.powerbi.com, correct?

 

3.) Are there plans to expand R capabilities within Power BI? 

 

Hi @Ski900,

 

#1. Yes, that link list the packages which power bi service allowed.

 

#2. Nope, publish to web feature measure a feature which used to share reports to networks, you can take a look at following link to know more about this feature.

Publish to web from Power BI

 

#3. I'm not so sure if power bi team has a plan on expand R script. Maybe you can direct contact team to ensure this.

 

In addition, did same issue appears on other web browsers? If this is a case, it may related to compatibility with power bi service. (For e.g. service has script calculation timeout limit, I think it might contains other limitation on formula calculation)

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.