Hi John,

I figured out the skipping of variables using a first subset & then making 
a second subset & it worked!

Thanks,

Natalie

__________________

You need to have a look at Chapter 5 of the Intro to
R.   I would recommend downloading the pdf and
printing it out.  It is not an easy read but it should
help.

newdata <- mydata[, c(PUMDID, Y_Q10A)]

or
newdata <- mydata[, c(1,33)]

should do the trick

--- Natalie O'Toole <[EMAIL PROTECTED]> wrote:

> Hi,
>
> Does anyone know how to skip variables (or columns)
> in R. Say, for example
> i had PUMFID position1 and Y_Q10A position 33 and i
> do not want to include
> all the variables in between. Is there a way to do
> this in R when you are
> extracting variables from a large .txt file with
> many, many variables?
>
> Thanks,
>
> Nat
>
> __________________
>
>
> Yes but I believe it will vary depending on what
> package you're using.  I don't deal with weigthed
> data
> so I'm not a good source
>
> Have a look at help for something like lm in the
> stats
>   package (part of the base installation) for an
> example.
>
> ?lm
>
> weight is the fourth argument down.
>
> However for more information try
> http://finzi.psych.upenn.edu/search.html and type in
> weight.
>
> As Brian Ripley says in a reply to a question about
> weights:
>  "Almost all methods I know of do: logistic
> regression, neural nets, classification trees, PPR
> .... "
>
>
> --- Natalie O'Toole <[EMAIL PROTECTED]> wrote:
>
> > Hi,
> >
> > Thank-you for the response!! That worked great!!
> Is
> > there any way to apply
> > a weight variable to your file similar to what you
> > can do in SPSS? So that
> > all of your other variables will be weighted by
> the
> > weight variable?
> >
> > Thanks,
> >
> > Nat
> >
> > __________________
> >
> >
> > Hi,
> >
> > i am trying to read a .txt file, do a couple of
> > select if statements on my
> > data, and then finally use the ?table function to
> > get frequency counts on
> > the data. Specifically, i am looking at answering
> > the following question:
> >
> > What is the frequency of Grade 7 students in the
> > province of Alberta who
> > are smokers?
> >
> > I am having some problems:
> >
> > 1)i cannot get the column names to show up when
> > print to screen
> >
> > 2)I cannot seem to skip variables properly when i
> > choose certain other
> > variables
> >
> > 3)i cannot get the combination of Select If
> > statements to work to produce
> > a different table with my new criteria
> >
> > Here are the variables
> >
> > PUMFID position1 length 5
> > PROV position 6 length 2
> > GRADE position 9 length 2
> > Y_Q10A position 33 length 1
> >
> >
> > Y_Q10A has the following 1=yes
> >                            2=no
> >                           9=skip
> >
> > all the others have no skipped or missing values
> >
> > Here is my code:
> >
> > myfile<-("c:/test2.txt")
> >
> myVariableNames<-c("PUMFID","PROV","GRADE","Y_Q10A")
> >
> > myVariableWidths<-c(5,2,2,1)
> >
> >
> >  mydata<-read.fwf(
> > file=myfile,
> > width=myVariableWidths,
> > col.names=myVariableNames,
> > row.names="PUMFID",
> > fill=TRUE,
> > strip.white=TRUE)
> >
> >
> > print(mydata)
> >
> > print( mydata [which(PROV=="AB" & GRADE==7 &
> > Y_Q10A<9), ] )
> >
> >
> >
> > Any help would be greatly appreciated!!
> >
> > Thank-you,
> >
> > Nat
> >
> >
>
------------------------------------------------------------------------------------------------------------------------
> >
> >
> > 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]]
> >
> > ______________________________________________
> > [email protected] 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.
> >
>
>
>
>       Be smarter than spam. See how smart SpamGuard
> is at giving junk
> email the boot with the All-new Yahoo! Mail at
> http://mrd.mail.yahoo.com/try_beta?.intl=ca
>
>
>
------------------------------------------------------------------------------------------------------------------------
>
>
> 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,
>
=== message truncated ===



Be smarter than spam. See how smart SpamGuard is at giving junk email the 
boot with the All-new Yahoo! Mail at 
http://mrd.mail.yahoo.com/try_beta?.intl=ca


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

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]]

______________________________________________
[email protected] 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