🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

"Execute R beginner"

User: "figueroajc"
New Altair Community Member
Updated by Jocelyn
Question 1:  I don't see input ports or output ports in my execute R operator.  Is this something that recently changed?  I just installed the R package yesterday but all the training videos I have found do make reference to these ports.

Question 2:   I have an existing R script that breaks down a date/time stamp into several other numerical attributes like hour of the week (1-168), hour of the day (1-24), etc.
The script works on 

I have not been able to make the script work with RM. I keep getting a message saying RM is not able to parse the code.

Here's the code that works elsewhere:

require('TimeDate')
require('xts')

df$PropertyTimestamp <- as.POSIXct(df$PropertyTimestamp, format = "%m/%d/%Y %H:%M", tz="GMT")
#Assign WeekDay
df$WeekDay <- as.POSIXlt(df$PropertyTimestamp)$wday
#Assign WeekendBinary
df$WeekendBinary <- ifelse(df$WeekDay %in% c(0,6), 1, 0)
#Assign MonthOfYear
df$MonthOfYear <- as.POSIXlt(df$PropertyTimestamp)$mon
#Assign WeekOfYear
df$WeekOfYear <- (as.POSIXlt(df$PropertyTimestamp)$yday) %/% 7
#Assign HourOfWeek
#df$HourOfWeek <- (df$WeekDay*24) + as.POSIXlt(df$PropertyTimestamp)$hour
#Assign WeekID
df$WeekID <- (as.POSIXlt(df$PropertyTimestamp)$year * 53)+ df$WeekOfYear
#Assign HourOfDay
df$HourOfDay <- as.POSIXlt(df$PropertyTimestamp)$hour


I know I need to couple this code with the rm_main = function(data)  from the operator, but I don't know how I would do this.

Thanks in advance for any help you can provide

Find more posts tagged with