Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowData Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more
Hello!
Query Editor R Script is changing the data type of text columns to integer automatically.
Fields as text type:
R script passing the data without any transformation:
Data output with data type changed:
Code generated automatically by R saved in folder 'C:/Users/x/AppData/Local/Radio/RScriptWrapper_83e78459-95e6-46bb-b903-5cf7ae45dd6a':
# Prolog - Auto Generated #
# To run this script, open it with an R editor with UTF-8 encoding and uncomment the following line(s):
# Sys.setenv(RPackagesLibrariesDirectory = 'C:/Users/x/AppData/Local/Radio/Library')
# Sys.setenv(RScriptWrapperWorkingDirectory = 'C:/Users/x/AppData/Local/Radio/RScriptWrapper_83e78459-95e6-46bb-b903-5cf7ae45dd6a')
.libPaths( c( Sys.getenv('RPackagesLibrariesDirectory'), .libPaths() ))
# Input load. Please do not change #
setwd(Sys.getenv('RScriptWrapperWorkingDirectory'))
`dataset` = read.csv('input_df_6ebc0c50-ee6b-475f-952f-c15af44c5915.csv', check.names = FALSE, encoding = "UTF-8", blank.lines.skip = FALSE);
# Original Script. Please update your script content here and once completed copy below section back to the original editing window #
output <- dataset
# Epilog - Auto Generated #
rm(dataset)
setwd(Sys.getenv('RScriptWrapperWorkingDirectory'))
rScriptWrapper_dataFrames <- list()
if (length(sapply(mget(ls(), .GlobalEnv), is.data.frame)) > 0 )
{
rScriptWrapper_dataFrames <- ls()[sapply(mget(ls(), .GlobalEnv), is.data.frame)]
for(x in rScriptWrapper_dataFrames) {assign(x, as.data.frame(get(x)))}
}
rScriptWrapper_options = getOption('save.image.defaults')
save(list = rScriptWrapper_dataFrames, file = "globalEnv.rdata", version = rScriptWrapper_options$version, ascii = FALSE, compress = TRUE)
Power BI's prolog code is using the function read.table to load the flat file without any parameter about data types of the source. The problem is being circumvented by reloading the file by the read_delim function with column definitions parameters for char type.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.