Just realized when read alteryx input into R tools, the column names will change if it doesn't comply with certain rules.
My guess is that the issue is somewhere in the Alteryx backend R code have
data.frame(...,check.names = TRUE)
Or other problems with
check.names
I feel it is a bit unexpected. Is it possible to fix or have other ways to keep column names of input?
Solved! Go to Solution.
Hi @frankzhang
This behaviour stems from the fact that R has problems referencing column names that contain spaces in DataFrames. To get around this, column names are cleaned on entry to remove any special characters using the equivalent of make.names(). The tidyverse tibbles version of the dataframe gets around this issue by enclosing offending column names with back tick characters `column name`, but it looks like the R tool in Alteryx hasn't taken advantage of this feature.
You can get around the behaviour by ensuring that the column names are cleaned before entry and then resetting them after output like this. This strategy avoids getting any surprises from the internal rename
This is a simple example that only deals with spaces, but the concept would be valid for more complex scenarios
This is a good suggestion, and you should add it to the Ideas forum on the community. I did a quick search and didn't find anything similar.
Dan
Thanks Dan. Thanks for this workaround solution. I wouldn't expect Alteryx can fix this in a short time..As I guess too many codes dependent on this. At lease they should warn in documentation someplace.