Hi,
Suppose I have the following data 

name     score
Abel        88
Baker      54
Charlie    77

stored a  table called myData.


I want to write a function that will create a table which is a subset of myData 
containing those have a score > 75.

I know I can do this with the following command:
subset(myData, score > 75)

But I would like to do this via a function, something like:

newTable <- function( data,  criteria){ 
                    subset( data, criteria) }

and then calling:     newTable(myData, score > 75)

But this doesn't work. I am sure there is a simple way to do this,
but I am stuck! Please help. Thanks!


Chris McCarthy, PhD
Department of Mathematics BMCC
Office: N522   Extension: 5235
cmccar...@bmcc.cuny.edu
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to