I am using SQL Server R Service and I am filling my @input_data_1 with a query. The resulting dataframe is factor by default when the column is varchar. How to obtain results as character data type?
STORED PROCEDURE
CREATE PROCEDURE myProc
AS
EXEC sp_execute_external_script
@language = N'R'
,@script=N'
df <- InputDataSet
x <- str(df)
OutputDataSet <- as.data.frame(x)
'
@input_data_1 = N'SELECT * FROM MyTable'
--will result in factor data type for both col1 and col2.
MyTable
col1 (varchar) | col2 (varchar)
-------------------------------
text1 | text4
text2 | text5
text3 | text6