Error in select unused arguments

Hi, I'm running the below code. I believe it comes from the Lahman library. For some reason it doesn't like my select statement. I get the error 'Error in select(., HR, BB, R) : unused arguments (HR, BB, R)'. Any ideas why? I have the following libraries loaded: Lahman, HistData, dplyr, tibble)

dat <- Teams %>% filter(yearID %in% 1961:2001 ) %>%
select(HR, BB, R)

It works as expected for me, try restarting your R session with Ctrl+Shift+F10 and running your code again.

library(dplyr)
library(Lahman)
Teams %>% 
    filter(yearID %in% 1961:2001 ) %>%
    select(HR, BB, R) %>% 
    head()
#>    HR  BB   R
#> 1 149 581 691
#> 2 112 647 729
#> 3 138 550 765
#> 4 176 539 689
#> 5 158 423 710
#> 6 150 492 737
2 Likes

Thank you! Very weird. I had typed that code over 9 or 10 times in different ways with the same result. Even completely different / simpler code.

1 Like

This topic was automatically closed 7 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.