Re: [R] How can I appoint a small part of the whole data

2009-09-06 Thread Yichih Hsieh
Dear Mark, many thanks for your suggestions ! best, yichih -- Yichih Hsieh e-mail : yichih.hs...@gmail.com [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do re

Re: [R] How can I appoint a small part of the whole data

2009-09-06 Thread Yichih Hsieh
Dear baptiste, many thanks for your suggestions ! best, yichih 2009/9/5, baptiste auguie : > > Hi, > > you have two problems in your first scenario, > > 1- Wrong operator precedence. For example, > > > 1 == 2 | 3 > [1] TRUE > > where 1==2 is tested as FALSE, but 1 is not tested against 3 for e

Re: [R] How can I appoint a small part of the whole data

2009-09-05 Thread Mark Difford
Yichih, Answer 2 is "correct," because your indexing specification for 1 is wrong. You also seem to have left out a comma. ## mu1990$wage[mu1990$edu==2|mu1990$edu==3|mu1990$edu==4, ] ## like this mu1990$wage[mu1990$edu%in%2:4, ] You really could have worked this out for yourself by looking at t

Re: [R] How can I appoint a small part of the whole data

2009-09-05 Thread baptiste auguie
Hi, you have two problems in your first scenario, 1- Wrong operator precedence. For example, > 1 == 2 | 3 [1] TRUE where 1==2 is tested as FALSE, but 1 is not tested against 3 for equality as it would be using, > 1 == 2 | 1 == 3 [1] FALSE or using %in% 2:3 Instead, R evaluates "FALSE | 3", a

Re: [R] How can I appoint a small part of the whole data

2009-09-05 Thread Yichih Hsieh
Dear all, I got another problem: if education have five levels edu=1 edu=2 edu=3 edu=4 edu=5 If I want to appoint y=edu2~4 in 1990 which programs is correct? I tried this two programs, they both work, but two results is different. 1. fig2b<-reldist(y=mu1990$wage[mu1990$edu==2|3|4],..) 2.

Re: [R] How can I appoint a small part of the whole data

2009-09-05 Thread Yichih Hsieh
Dear Petr, your suggestion is useful many thanks for your help ! best, Yichih 2009/9/3 Petr PIKAL > Hi > > use any of suitable selection ways that are in R. > > E.g. > > data[data$gender==1, ] > > selects only female values > > data$wage[(data$gender==1) & (data$race=1)] selects black femal

[R] How can I appoint a small part of the whole data

2009-09-03 Thread Yichih Hsieh
Dear all, I have 1980~1990 eleven datas, every year have three variables, wage gender(1=female, 2=male) race(1=black, 2=white) My original commands is: fig2b<-reldist(y=mu1990$wage,yo=mu1980$wage,...) I have three questions: 1. If I want to appoint y=women's wage in 1990