Does anyone know why it is giving me this error? Any help would be greatly 
appreciated!!

Thanks,

Nat



myfile<-("c:/test2.txt")
mysubset<-myfile
mysubset$Y_Q02 <-mysubset$DVSELF <-NULL
mysubset2<-mysubset
mysubset2$Y_Q10B <-mysubset2$GP2_07 <-NULL

myVariableNames<-c("PUMFID=rnorm(10)","PROV=rnorm(10)","REGION=rnorm(10)","GRADE=rnorm(10)","Y_Q10A=rnorm(10)","WTPP=rnorm(10)")
> df<-mysubset2[, 2:5] * mysubset2[, 6]
myVariableWidths<-c(5,2,1,2,1,12.4)
df<-read.fwf(
file=myfile,
width=myVariableWidths,
col.names=myVariableNames,
row.names="PUMFID",
fill=TRUE,
strip.white=TRUE)

happyguys<-subset(df, PROV==48 & GRADE == 7  & Y_Q10A < 9)
print(happyguys)


where it is bolded, i'm getting the following error: Error in mysubset2[, 
2:5] : incorrect number of dimensions

__________________

__________________


Hi Dr. Kubovy,

Here is my code so far: My question is: how do I then get a frequency
count of Y_Q10A with the WTPP applied to it?

myfile<-("c:/test2.txt")
mysubset<-myfile
mysubset$Y_Q02 <-mysubset$DVSELF <-NULL
mysubset2<-mysubset
mysubset2$Y_Q10B <-mysubset2$GP2_07 <-NULL

myVariableNames<-c("PUMFID","PROV","REGION","GRADE","Y_Q10A","WTPP")
myVariableWidths<-c(5,2,1,2,1,12.4)


mysubset2<-read.fwf(
file=myfile,
width=myVariableWidths,
col.names=myVariableNames,
row.names="PUMFID",
fill=TRUE,
strip.white=TRUE)



print(mysubset2)

happyguys<-subset(mysubset2, PROV==48 & GRADE == 7  & Y_Q10A < 9)
print(happyguys)


df <- data.frame(PROV = rnorm(10), REGION = rnorm(10), GRADE = rnorm
(10), Y_Q10A = rnorm(10), WTTP = rnorm(10))
df1 <- df[, 1:4] * df[, 5]

Thanks,

Nat


__________________


df <- data.frame(PROV = rnorm(10), REGION = rnorm(10), GRADE = rnorm
(10), Y_Q10A = rnorm(10), WTTP = rnorm(10))
df1 <- df[, 1:4] * df[, 5]
The column you were worried about is not part of the data.
You can get a vector of the record ids by
rownames(df)

On Apr 27, 2007, at 1:05 PM, Natalie O'Toole wrote:

> I have the file below called happyguys. It is a subset of data. How
> do I
> apply the weight variable (WTPP) to this file? Can i just multiply
> each
> column (except the first column because it is a record id) by WTPP?
> If the
> answer is yes, how do I multiply one variable name by another?
>
>   PROV REGION GRADE Y_Q10A         WTPP
> 83      48      4     7      2 342233324020
> 115     48      4     7      1 434413433040
> 185     48      4     7      1 432312433040
> 222     48      4     7      2 133112222030
> 242     48      4     7      1 421313332020
> 247     48      4     7      2 312134212030
<snip>
_____________________________
Professor Michael Kubovy
University of Virginia
Department of Psychology
USPS:     P.O.Box 400400    Charlottesville, VA 22904-4400
Parcels:    Room 102        Gilmer Hall
McCormick Road    Charlottesville, VA 22903
Office:    B011    +1-434-982-4729
Lab:        B019    +1-434-982-4751
Fax:        +1-434-982-4766
WWW:    http://www.people.virginia.edu/~mk9y/



------------------------------------------------------------------------------------------------------------------------

This communication is intended for the use of the recipient to which it is
addressed, and may
contain confidential, personal, and or privileged information. Please
contact the sender
immediately if you are not the intended recipient of this communication,
and do not copy,
distribute, or take action relying on it. Any communication received in
error, or subsequent
reply, should be deleted or destroyed.
------------------------------------------------------------------------------------------------------------------------

This communication is intended for the use of the recipient to which it is
addressed, and may
contain confidential, personal, and or privileged information. Please
contact the sender
immediately if you are not the intended recipient of this communication,
and do not copy,
distribute, or take action relying on it. Any communication received in
error, or subsequent
reply, should be deleted or destroyed.
[[alternative HTML version deleted]]

______________________________________________
R-help@stat.math.ethz.ch 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.

------------------------------------------------------------------------------------------------------------------------
 

This communication is intended for the use of the recipient to which it is 
addressed, and may
contain confidential, personal, and or privileged information. Please 
contact the sender
immediately if you are not the intended recipient of this communication, 
and do not copy,
distribute, or take action relying on it. Any communication received in 
error, or subsequent
reply, should be deleted or destroyed.
        [[alternative HTML version deleted]]

______________________________________________
R-help@stat.math.ethz.ch 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