Using the subset argument with R's t.test command

r

Solution

You just need to specify a vector of which cases to drop, like:

test <- data.frame(x=rnorm(100),y=rep(1:2,each=50))
t.test(x ~ y, data=test, subset=-40)

So in your case it should be:

t.test(Dioxin~Veteran,data=case0302,var.equal=TRUE,alternative="less",
   subset=-646)

As @flodel notes, more info on the `subset=` argument is available in `?model.frame`:

  subset: a specification of the rows to be used: defaults to all rows.
          This can be any valid indexing vector (see ‘[.data.frame’)
          for the rows of ‘data’ or if that is not supplied, a data
          frame made up of the variables used in ‘formula’.

Problem

I'd like to select all but the 646 row of a data frame by using the subset argument of R's t.test command. I tried: ``` require(mosaic) require(Sleuth3) t.test(Dioxin~Veteran,data=case0302,var.equal=TRUE,alternative="less", subset=case0302[-646,]) ``` But that didn't work. Any suggestions?

Original source