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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

R script not finding function "mutate"

The report looks well on Power BI desktop, using my R installation.

I assume (correct me if I'm wrong) that uploading to Power BI web, would use some server's R installation. 

I fixed some syntaxis R erros, but I'm still getting the following Runtime Error. 

Script Runtime Error
Attaching package: 'magrittr'
The following object is masked from 'package:tidyr':
    extract
Error in mutate(., estatus = str_replace_all(estatus, c(`Activo en mora` = "Act. moroso",  : 
  could not find function "mutate"
Please try again later or contact support. If you contact support, please provide these details.
Activity ID: ec2aeacf-da36-4a44-a142-b9ca62791453
Request ID: 0f8f7499-f29c-59c3-e35d-196cba081278
Correlation ID: 66306c9c-9f20-06ca-407c-16df2f3a09d1
Time: Wed Aug 26 2020 09:00:51 GMT-0500 (Central Daylight Time)
Service version: 13.0.14114.68
Client version: 2008.2.02476-train
Cluster URI: https://wabi-south-central-us-redirect.analysis.windows.net/

 

The code I run is not complicated, it uses standard tidyverse functions:  

It is based on importing two columns of a dataset:  prob_rf, status

# The following code to create a dataframe and remove duplicated rows is always executed and acts as a preamble for your script: 
# dataset <- data.frame(prob_rf, status)
# dataset <- unique(dataset)

# Paste or type your script code here:
library(ggplot2)
library(dplyr)
library(magrittr)
library(scales)

dens_status <- as_tibble(dataset) %>% 
    mutate(fecha_aft = ymd_hms(fecha_aft), 
      estatus = str_replace_all(status, c(
        "Activo en mora" = "Act. moroso", 
        "Activo pre cancelado" = "Act. pre-Canc.", 
        "Suspensión Temporal" = "Susp. Temp."))) %>%
    ggplot(aes(fecha_aft, color=status, fill=status)) + 
    geom_density(alpha = 0.5) + 
        scale_x_datetime("AFT") + 
        scale_y_continuous("Densidad", labels = NULL)

print(dens_status)

 

Also, 1 of the 4 plots that I'm creating with R, does show up fine.  But not the other 3.  

Diego-CDMX_0-1598451047700.png

 

Regards from Mexico. 

Diego 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Thank you @Greg_Deckler , @amitchandak 

It turned out I was missing the loading of a package in the code snippet. 

 

Thus, Desktop would load it correctly on my PC, but not on the web server. 

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous , refer if this can help

https://stackoverflow.com/questions/46678265/mutate-using-r-could-not-be-found

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Greg_Deckler
Community Champion
Community Champion

@Anonymous - Check that you are using a supported package and version of that package:

https://docs.microsoft.com/en-us/power-bi/connect-data/service-r-packages-support

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Thank you @Greg_Deckler , @amitchandak 

It turned out I was missing the loading of a package in the code snippet. 

 

Thus, Desktop would load it correctly on my PC, but not on the web server. 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.