s-news
[Top] [All Lists]

Re: Sub setting data

To: "Overstreet, Jason (FL51)" <Jason.Overstreet@honeywell.com>, <s-news@lists.biostat.wustl.edu>
Subject: Re: Sub setting data
From: "Stewart, William" <william.stewart@rbc.com>
Date: Fri, 16 Sep 2005 16:43:37 -0400
Thread-index: AcW6/RU5Hb9bNwF9S0imX7o092Oi+AAAgN2Q
Thread-topic: [S] Sub setting data
Jason,
 
    The following should do what you want:
 
test.df1 <- data.frame(key=c(1:10), data="">test.df2 <- data.frame(to.get=c(2,4,6,8,10))
test.df1[test.df2$to.get,]
 

-------------------------
William A. Stewart
Manager, Operational Risk
RBC Financial Group
william.stewart@rbc.com
phone: 416-974-3019

-----Original Message-----
From: s-news-owner@lists.biostat.wustl.edu [mailto:s-news-owner@lists.biostat.wustl.edu]On Behalf Of Overstreet, Jason (FL51)
Sent: Friday, September 16, 2005 4:26 PM
To: s-news@lists.biostat.wustl.edu
Subject: [S] Sub setting data

I have a list of several hundred observations in one data frame that has several dozen variables.  In a second data frame, I have a subset of the first data frame containing only the serial number (primary key) of the first data frame.  I want to build a data frame that has all the variables in the first data frame, but only for the observations that are listed in the second data frame.  Thanks in advance for any help.


Jason Overstreet

Statistician

Honeywell DSES

(727) 539-3964

__________________________________________________________________________________________________________________________________

This e-mail may be privileged and/or confidential, and the sender does not waive any related rights and obligations.
Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthorized.
If you received this e-mail in error, please advise me (by return e-mail or otherwise) immediately.  

Ce courrier électronique est confidentiel et protégé. L'expéditeur ne renonce pas aux droits et obligations qui s'y rapportent.
Toute diffusion, utilisation ou copie de ce message ou des renseignements qu'il contient par une personne autre que le (les) destinataire(s) désigné(s) est interdite.
Si vous recevez ce courrier électronique par erreur, veuillez m'en aviser immédiatement, par retour de courrier électronique ou par un autre moyen.

Attachment: Stewart, William.vcf
Description: Stewart, William.vcf

<Prev in Thread] Current Thread [Next in Thread>