>From my larger data set I created a subset of it by using:subset_1 <- subset(timeuse, IndepTrans = 1, Physical = 1) where my larger data set is "timeuse" and the smaller subset is "subset_1". The subset was conditioned on "IndepTrans" equaling "1" in the data and "Physical" equaling "1" as well. I want to be able to compute the median of a variable first for the larger data set "timeuse" then for the subset file "subset_1". How do I identify to R which data set I'm wanting the median computed for? I've tried many possibilities but for some reason can't figure it out. Thanks, Matt. [[alternative HTML version deleted]]
On Jun 2, 2013, at 08:08 , Matt Stati wrote:>> From my larger data set I created a subset of it by using: > > subset_1 <- subset(timeuse, IndepTrans = 1, Physical = 1)That's not going to work. Try subset(timeuse, (IndepTrans == 1) & (Physical == 1)) (Whenever you do things like this, run summary(subset_1) to check.) -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com
On 02-06-2013, at 08:08, Matt Stati <mattstati at yahoo.com> wrote:>> From my larger data set I created a subset of it by using: > > subset_1 <- subset(timeuse, IndepTrans = 1, Physical = 1) > > where my larger data set is "timeuse" and the smaller subset is "subset_1". The subset was conditioned on "IndepTrans" equaling "1" in the data and "Physical" equaling "1" as well. I want to be able to compute the median of a variable first for the larger data set "timeuse" then for the subset file "subset_1". How do I identify to R which data set I'm wanting the median computed for? I've tried many possibilities but for some reason can't figure it out.?with with(timeuse, median(?)) with(subset_1, median(?)) Berend