[R] help sub setting data frame

2009-10-22 Thread Sean MacEachern
Hi, I'm running into a problem subsetting a data frame that I have never encountered before: dim(chkPd) [1] 32136 df = head(chkPd) df PNWB Sire Dam MG SEX 601 1001 715349 61710 61702 67F 969 1001_1 511092 616253 615037 168F 986

Re: [R] help sub setting data frame

2009-10-22 Thread Ista Zahn
Hi Sean, Comment in line below. On Thu, Oct 22, 2009 at 5:39 PM, Sean MacEachern sean.mace...@gmail.com wrote: Hi, I'm running into a problem subsetting a data frame that I have never encountered before: dim(chkPd) [1] 3213    6 df = head(chkPd) df               PN        WB      Sire  

Re: [R] help sub setting data frame

2009-10-22 Thread Sean MacEachern
Hi Ista, I think I'm suffering long dayitis myself. You are probably right. I don't use subset that often. I typically use brackets to subset dataframes. Essentially what I am trying to do is take my original dataframe (chkPd) and subset it using a smaller dataframe with some matching PN IDs.

Re: [R] help sub setting data frame

2009-10-22 Thread Ista Zahn
Is this what you want? df = data.frame('id'=c(1:100),'res'=c(1001:1100)) dfb=df[1:10,] dfc = df[df$id %in% dfb$id,] Still not sure, but that's my best guess. Going back to your original data you can try dfb = chkPd[chkPd$PN %in% df$PN,] Hope it helps, Ista On Thu, Oct 22, 2009 at 6:10 PM,

Re: [R] help sub setting data frame

2009-10-22 Thread Sean MacEachern
Works perfectly! Thanks to all who responded. Sean On Thu, Oct 22, 2009 at 6:24 PM, Ista Zahn istaz...@gmail.com wrote: Is this what you want? df = data.frame('id'=c(1:100),'res'=c(1001:1100)) dfb=df[1:10,] dfc = df[df$id %in% dfb$id,] Still not sure, but that's my best guess. Going back