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:


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


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




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


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 '>'
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.