Forum Discussion
Query Editor R Script Date Time Issues
- 9 years ago
Okay, so I got it to work... using lubridate and setting na.rm=TRUE when doing the max calculation. I'm going to have to verify, but my data shouldn't have any na's in the column???
# 'dataset' holds the input data for this script library(lubridate) output <- as.data.frame(dataset, stringsAsFactors = FALSE) output$discovery_date_utc_new <- ymd_hms(output$discovery_date_utc) end_date <- max(output$discovery_date_utc_new, na.rm=TRUE) output$end_date <- end_date
Anyhow, in my VERY limited time working with R and R within a Query Edit window in PowerBI... Here are my wish list items:
- Integration into RStudio IDE
- If that isn't doable at least a way to see output, so I can print variables from the R script and review them
- 9 years ago
So I got the code working, but found two issues...
- One are that dates are being converted to character factors
- Two it seems that passing data that has non-printable unicode characters from PowerBI to an R dataframe seems to have an issue. By clicking the clean text for every text column prior to executing an R script seemed to fix the issue.
RStudio integration does exist. Can't remember which release but it's been around for at least a couple of months I think.
File -> Options and Settings -> Options -> R Scripting you can associate an external IDE with Power BI.
Then, from within the R Visual edit window there's a new icon on at the top, an arrow pointing North East - this will copy your code to your associated IDE and extremely conveniently package up the data items you pass into the R Visual and store them in a referenced CSV within R Studio.
Any changes you make to the code you will have to manually cut and paste back to Power BI but it's still pretty nifty the way they have done the integration.
HTH
Sacha
Thanks Sacha, however, I'm talking about integration within the Power BI Query Editor... not within R visuals.
- Anonymous9 years agoNot applicableYup, you're correct. It quite clearly mentions query editor in the post title. Apologies.
Hopefully they will introduce IDE support for R Scripting throughout Power BI soon.
Cheers
Sacha