Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

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.  

 

Regards from Mexico. 

Diego 

  • Anonymous's avatar
    Anonymous
    6 years ago

    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. 

3 Replies