[R] Drop a part of an array\list\vector?

David Winsemius dwinsemius at comcast.net
Thu Jan 7 20:41:22 CET 2010


On Jan 7, 2010, at 1:15 PM, Idgarad wrote:

> I did have a verbose description of why but rather then make  
> everyone's eyes
> bleed with useless details I ask the following :)
> To make a long story short: How can I make newmcReg[[i]]["PreIO308"]  
> go
> away in the following list... er vector... no wait array....  
> dataframe....
> awww crap...
>

The data type returned by summary appears to be  ....  a table, ...   
which means it can be indexed as would be a matrix:


 > summary(data.frame( a= c(TRUE, FALSE, TRUE), b= c(TRUE,TRUE,TRUE),  
cc =c("a", "b" , "c") ))
      a              b           cc
  Mode :logical   Mode:logical   a:1
  FALSE:1         TRUE:3         b:1
  TRUE :2         NA's:0         c:1
  NA's :0

 > str(summary(data.frame( a= c(TRUE, FALSE, TRUE), b=  
c(TRUE,TRUE,TRUE), cc =c("a", "b" , "c") )))
  'table' chr [1:4, 1:3] "Mode :logical  " "FALSE:1        " "TRUE : 
2        " "NA's :0        " ...
  - attr(*, "dimnames")=List of 2
   ..$ : chr [1:4] "" "" "" ""
   ..$ : chr [1:3] "    a" "   b" "cc"

 > summary(data.frame( a= c(TRUE, FALSE, TRUE), b= c(TRUE,TRUE,TRUE),  
cc =c("a", "b" , "c") ))[, 1:2]
      a                b
  "Mode :logical  " "Mode:logical  "
  "FALSE:1        " "TRUE:3        "
  "TRUE :2        " "NA's:0        "
  "NA's :0        " NA

Although there appear to be some underlying print-issues.

-- 
David


>
> summary(newmcReg[[i]])
> UNITBUILD         UNITDB         ITBUILD           ITDB
> Mode :logical   Mode :logical   Mode :logical   Mode :logical
> FALSE:249       FALSE:249       FALSE:249       FALSE:249
> TRUE :21        TRUE :21        TRUE :21        TRUE :21
>
>
>
>  UATBUILD         UATDB         HOGANCODE          ACF
> Mode :logical   Mode :logical   Mode :logical   Mode :logical
> FALSE:250       FALSE:250       FALSE:208       FALSE:225
> TRUE :20        TRUE :20        TRUE :62        TRUE :45
>
>
>
>    RCF          ReleaseST1      ReleaseST2      ReleaseBLA
> Mode :logical   Mode :logical   Mode :logical   Mode :logical
> FALSE:186       FALSE:167       FALSE:157       FALSE:228
> TRUE :84        TRUE :103       TRUE :113       TRUE :42
>
>
>
> MonthlyST1      MonthlyST2      MonthlyBLA       
> Small.Bank.Acquisitions
> Mode :logical   Mode :logical   Mode :logical   Min.   :0.0000
> FALSE:107       FALSE:105       FALSE:147       1st Qu.:0.0000
> TRUE :163       TRUE :165       TRUE :123       Median :0.0000
>                                                 Mean   :0.1556
>                                                 3rd Qu.:0.0000
>                                                 Max.   :1.0000
>  Conversions      Build.New.Environment HLY.NewYear      HLY.MLK
> Min.   :0.00000   Mode :logical         Mode :logical   Mode :logical
> 1st Qu.:0.00000   FALSE:262             FALSE:266       FALSE:264
> Median :0.00000   TRUE :8               TRUE :4         TRUE :6
> Mean   :0.08889
> 3rd Qu.:0.00000
> Max.   :1.00000
>  HLY.PRES       HLY.MEMORIAL      HLY.J4        HLY.LABOR
> Mode :logical   Mode :logical   Mode :logical   Mode :logical
> FALSE:264       FALSE:265       FALSE:265       FALSE:265
> TRUE :6         TRUE :5         TRUE :5         TRUE :5
>
>
>
> HLY.COLUMBUS     HLY.VETS       HLY.THANKS       HLY.XMAS
> Mode :logical   Mode :logical   Mode :logical   Mode :logical
> FALSE:265       FALSE:265       FALSE:265       FALSE:265
> TRUE :5         TRUE :5         TRUE :5         TRUE :5
>
>
>
> HLY.ELECT       HLY.PATRIOT        EOM            NEWMF
> Mode :logical   Mode :logical   Mode :logical   Mode :logical
> FALSE:265       FALSE:265       FALSE:210       FALSE:263
> TRUE :5         TRUE :5         TRUE :60        TRUE :7
>
>
>
>  PreIO47         PreIO151        PreIO164        PreIO169
> Mode :logical   Mode :logical   Mode :logical   Mode :logical
> FALSE:269       FALSE:269       FALSE:269       FALSE:269
> TRUE :1         TRUE :1         TRUE :1         TRUE :1
>
>
>
>  PreIO197        PreIO203        PreIO209        PreIO241
> Mode :logical   Mode :logical   Mode :logical   Mode :logical
> FALSE:269       FALSE:269       FALSE:269       FALSE:269
> TRUE :1         TRUE :1         TRUE :1         TRUE :1
>
>
>
>  PreIO261        PreIO308
> Mode :logical   Mode :logical
> FALSE:269       FALSE:270
> TRUE :1
>
>
> (the PreIO are outliers identified from the output of stl() e.g.  
> outliers in
> the source data)
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org 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.

David Winsemius, MD
Heritage Laboratories
West Hartford, CT



More information about the R-help mailing list