I keep getting this error: Error in filter():
! Problem while computing ..1 = dfnew.
The code works up to the filter function
Input ..1$year must be a logical vector, not a integer.
Are you sure? If your code here is what you actually have then you have typos.
lbrary(dplyr) should be library(dplyr) & Library(babynames) should be library(babynames)
However the real problem seems that filter(dfnew, age < 78)
should be filter(age < 78)
You are creating and filtering the age variable from babynames. You have not created dfnew until the mutate and filtre functions are finished.
I have edited the code as below.
When you are creating new data frame, there is no need for mentioning the new data frame's name inside filter function.
If your question's been answered , would you mind choosing a solution? It helps other people see which questions still need help, or find solutions if they have similar problems. Here’s how to do it: