Beginner here: Getting Error message - object "x" not found. Tried to solve, no progress.

I'm getting this error message:

Error in mutate(duration = as.numeric(duration)) :
object 'duration' not found

I can see in the "data window" that I have the duration object in my data set, so I don't know why it's not working?

Also, the code I'm running (like a pre-made guide script that I'm supposed to work through) has pipes. Some code ends with the %>% and when I try to copy the whole line of code it R says it's an unfinished argument? The %>%'s work when they're in the line (anything but at the end).

Hope someone can help me!
Best wishes

Two guesses here since you have not shared the data frame:

  1. Check how 'duration' is typed in the data, R is case sensitive

  2. If the conversion to numeric is not okay, you may have that error.

As for the %>% it must be end of line not necessarily on the same line. No any code, like ',', comes after it. To ensure end of line hit the return key.

Hi @141 , check this example with iris data set:

iris <- iris %>% mutate(Sepal.Length ='NewVariableName')
iris %>% head(8)

Thank you! It was a very easy problem with the piping, I simply did not realize the + wasn't an issue (the +) and that I should continue adding code until all the arguments were finished with an ). (Very much a beginner here forgive me haha)