Hi peers in below data i want to subset values with M in Sex Column, when i am using filter function i am getting following error

image

My Program:

Males <- Filter(Class_, Sex=="M")

Log: Error in get(as.character(FUN), mode = "function", envir = envir) :
object 'Class_' of mode 'function' was not found

R is case sensitive. There is no function “Filter” currently in namespace. (Update: I was wrong about Filter() not being in namespace, it is in {base}, so of course it is. However, it was misused.)
For a data frame named d

Males <- d[which(d$Sex == “M”),]

will return a data frame.

2 Likes

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