Forum Discussion

MARKZI's avatar
MARKZI
Frequent Visitor
1 year ago
Solved

[R] Leaflet Visual works on Desktop, breaks on Service

Hello fellow developers,   i have developed a custom R Visual (leaflet map) in Power BI using R Studio. The visual works just as intended on Desktop Version but once i publish the dashboard to serv...
  • MARKZI's avatar
    MARKZI
    1 year ago

    Coming back to this thread with the solution:

     

    I noticed that the class(df[,4]) with 4 being one of my True/False Layer returned different types on local and on services. On Local i received character which i succesfully casted on logical. On Services this line of code returned integer. I played around with more robust casting and datatype differentiation and fixed it like this:

    for (col in extra_columns) {
      if (col %in% colnames(df)) {
        if (!is.logical(df[[col]])) { 
          df[[col]] <- as.logical(ifelse(df[[col]] %in% c("True", "true", "1"), TRUE, FALSE))
        }
      }
    }