Error in using select() function in dplyr package

Hi, i try to modify dataset using dplyr, but it show some error

my data set is:

library(downloader) 
url <- "https://raw.githubusercontent.com/genomicsclass/dagdata/master/inst/extdata/mice_pheno.csv"
filename <- basename(url)
download(url, destfile=filename)
dat <- na.omit( read.csv(filename) )

My code is:

library(dplyr)
y <- filter(dat, Sex=="M" & Diet=="chow") %>% select(Bodyweight) %>% unlist
z <- ( y - mean(y) ) / popsd(y)
qqnorm(z);abline(0,1)

The result

y <- filter(dat, Sex=="M" & Diet=="chow") %>% select(Bodyweight) %>% unlist
Error in select(., Bodyweight) : unused argument (Bodyweight)

Can anybody help me to fix the error?

I do restart R session with ctrl + shift + F10, but the error still appear

edit:
Nope, i solved it. maybe the problem because i have y variable before in my worksheet. After i remove(y), i can define new y

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