Hi, my R code and output in Rstudio looks like below. How do I do the same in alteryx?
data.tb
## Output -->
name | date |
john smith | 2022-07-21 |
file.df <- data.frame(
col_a = data.tb[1,1]
col_b = data.tb[1,2]
message = "hello world"
)
file.df
## Output -->
name | date | message |
john smith | 2022-07-21 | hello world |
Issue: when I try to do the same in alteryx, only the value is getting filled, but not the column names. I am getting below output in alteryx
## Output -->
col_a | col_b | message |
john smith | 2022-07-21 | hello world |
Hi, thank you for your solution. But I am trying to rename the first two columns as well.
so from col_a and col_b to name and date. I know i can use select tool to do it afterwards. But I am asking if it's possible to do it using R tool?
hi thank you again for your reply. Sorry I should have clarified it better. I want to update column name AND values at the same time using data from ANOTHER file.
so lets say file#1 looks like below
col_a | message |
1 | hello |
2 | world |
file#2 contains the following data
name | date |
john | 2022 |
smith | 2021 |
Now i want to use the data from file#2 and replace it with column#1 in file#1 completely.
so file#1 will now look like below
name | message |
john | hello |
smith | world |
This is pretty simple in Alteryx with the Join tool but for R I'd suggest looking into merge.
ok thank you i will look into it