cancel
Showing results for 
Search instead for 
Did you mean: 

How to use sys.date() function in R tool?

SOLVED
Highlighted
sam2
Atom

I am using R tool inside Alteryx and want to populate certain rows with today's date. It is giving me error that it could not find that function. I also tried to use DateTimeToday() inside R but it also shows error. I don't want to use formula tool to add today's date and want to achieve the same inside R. Could someone help me out here?

Alteryx
Alteryx

Hi @sam2

 

I was able to use the R Sys.Date() function in the R Tool, appending the current date to a new column in a data frame with the following code.

 

##read in data frame
data <- read.Alteryx('#1')

##append new column with today's date
data$date <- Sys.Date()

##write out data frame
write.Alteryx(data, 1)

I've also attached the workflow. Can you please share the error you are getting, along with your code? I would be happy to help you troubleshoot.

 

Thanks!

 

 

sam2
Atom

Hi @SydneyF

 

It turns out that Alteryx is case sensitive. I was using "sys.date()" instead of "Sys.Date()". Thank you for your help on this.

 

Sam