mutate in Kaggle

I am trying to create a workbook in Kaggle with the code I wrote in RStudio. It worked just fine in RStudio but then when I try to run it in Kaggle I keep getting this message. Idk if I have to make my content in RStudio into a markdown file first? Here is the dataset:

|Id|ActivityDate|TotalSteps|TotalDistance|TrackerDistance|LoggedActivitiesDistance|VeryActiveDistance|ModeratelyActiveDistance|LightActiveDistance|SedentaryActiveDistance|VeryActiveMinutes|FairlyActiveMinutes|LightlyActiveMinutes|SedentaryMinutes|Calories|
|||||||||||||||||
|1|1503960366|4/12/2016|13162|8.50|8.50|0|1.88|0.55|6.06|0|25|13|328|728|1985|
|2|1503960366|4/13/2016|10735|6.97|6.97|0|1.57|0.69|4.71|0|21|19|217|776|1797|
|3|1503960366|4/14/2016|10460|6.74|6.74|0|2.44|0.40|3.91|0|30|11|181|1218|1776|

So, below is the code to change the ActivityDate from a character to a date and a column for weekday.

class(activity2$ActivityDate)

activity2 <- activity2 |> mutate("ActivityDate" = mdy(ActivityDate), Weekday = wday(ActivityDate, label = TRUE))

class(activity2$ActivityDate)

print(activity2$Weekday)

class(sleep$SleepDay)

sleep <- sleep |> mutate("SleepDay" = as.Date(SleepDay, format = "%m/%d/%Y %H:%M:%S"))

class(sleep$SleepDay)

head(sleep, 3)
head(activity2, 3)

This is the Error I keep getting. I have tried wrapping ActivityDate and SleepDate in "" but get the same error. I have also tried taking the '>' out after the pipe but get an error. Any ideas on how to fix this? I cant move forward without it being fixed.

Error in parse(text = x, srcfile = src): :5:25: unexpected '>'
4:
5: activity2 <- activity2 |>

you are using the new pipe symbol |> this was only introduced as a language feature in R4.1 and Kaggle run
R version 4.0.5 (2021-03-31)
I determined this by running sessionInfo() in their code notebook.

If you are using dplyr, then you have access to the dplyr/magrittr pipe which looks like %>%

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.