The correlation test function says that it can do a subset where one specifies the subsete vector. I cannot seem to get it to work. For example, the command line is: cor.test(adults$Alt, adults$Cab, alternative="greater", method="pearson") So, let?s say my subset vector is "Sex". How would I state the command to get the test of that subset? Thanks in advance. Jim -- James J. Roper, Ph.D. James J. Roper Ecologia, Evolu??o e Din?micas Populacionais de Vertebrados Terrestres ------------------------------------------------------------------------ Caixa Postal 19034 81531-990 Curitiba, Paran?, Brasil ------------------------------------------------------------------------ E-mail: jjroper at gmail.com <mailto:jjroper at gmail.com> Telefone: 55 41 33857249 celular: 55 41 99870543 ------------------------------------------------------------------------ Ecologia e Conserva??o na UFPR <http://www.bio.ufpr.br/ecologia/> Home Page <http://jjroper.googlespages.com> Ars Artium Consulting <http://arsartium.googlespages.com>
James J. Roper <jjroper <at> gmail.com> writes:> > The correlation test function says that it can do a subset where one > specifies the subsete vector. I cannot seem to get it to work. > > For example, the command line is: > > cor.test(adults$Alt, adults$Cab, alternative="greater", method="pearson") > > So, let?s say my subset vector is "Sex". How would I state the command > to get the test of that subset? > > Thanks in advance. > > JimThe subset argument only applies to the formula method. It should be a boolean vector something like the following (assuming adults is a data frame): cor.test(~ Alt + Cab, adults, Sex=="MALE", alternative="greater", method="pearson")
You have to use the formula interface, so something like this: cor.test(~ Alt + Cab, data=adults, alternative="greater", subset=Sex=="male") David On Wed, Mar 19, 2008 at 12:59 PM, James J. Roper <jjroper at gmail.com> wrote:> The correlation test function says that it can do a subset where one > specifies the subsete vector. I cannot seem to get it to work. > > For example, the command line is: > > cor.test(adults$Alt, adults$Cab, alternative="greater", method="pearson") > > So, let?s say my subset vector is "Sex". How would I state the command > to get the test of that subset? > > Thanks in advance. > > Jim > -- > > > James J. Roper, Ph.D. > > James J. Roper > Ecologia, Evolu??o e Din?micas Populacionais > de Vertebrados Terrestres > ------------------------------------------------------------------------ > Caixa Postal 19034 > 81531-990 Curitiba, Paran?, Brasil > ------------------------------------------------------------------------ > E-mail: jjroper at gmail.com <mailto:jjroper at gmail.com> > Telefone: 55 41 33857249 > celular: 55 41 99870543 > ------------------------------------------------------------------------ > Ecologia e Conserva??o na UFPR <http://www.bio.ufpr.br/ecologia/> > Home Page <http://jjroper.googlespages.com> > Ars Artium Consulting <http://arsartium.googlespages.com> > > ______________________________________________ > R-help at 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. >-- David Barron Said Business School Park End Street Oxford OX1 1HP 01865 288906