left_join error

The code below gives me an error when I try to knit it into a pdf.
Otherwise it works properly.

actual_user_ratings <- train %>% left_join(actual_movie_ratings,by='movieId') %>%
group_by(userId) %>% summarise(b_y = mean(rating - mu - b_i))

Error in UseMethod("left_join") :
no applicable method for 'left_join' applied to an object of class "function"
Calls: ... eval -> _fseq -> freduce -> -> left_join

This suggests that train is a function while you think that it is a data.frame ?

What do you mean by

The code below gives me an error when I try to knit it into a pdf.
Otherwise it works properly.

I think it will also fail when you do not knit it or when you knit it to html (??)
This information does not help.

In the same way adding tags that are not relevant does not help:
how is this related to package-installation ?

When I run the .R file, this chunk of code shows me no error. Only when I try to knit it, it gives me an error. Do I have to install any particular package to clear out this error?

I said that the error message suggest that train is not a data.frame. Check in the chunk before you use the code the contents oftrain. If it is indeed not a data.frame maybe you did not run the chunk where it should be filled with data?

Sorry it was a grammatical error. It has been rectified now

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