Hi everybody,
 
Well, I really hoped that until now i know how to do a selection ..... but 
obviously i don't. So risking your laughing at me - here you go.
 
I have a table with lots of vegetation data, and one column specifies in which 
region the data is. There are only 2 regions, region 1 and region 3. I want to 
select all data that belong to region 1 and after do some xtabs on it. If i do 
everything correctly i thought that i will have only the data from region one 
in my result .... it seems not. The uniqueID - is the location name that has 
incorporated into it the region as well, cat3_name is the category name and 
Total is the actual numeric data i am interested in tabulating. There are few 
other columns but for my immediate purpose they are not of interest now.
 
Code (and i hope it does not come scrambled):
----------------------
 
> x3 <- read.csv("unique_veg_id.csv")
### columns in my data:
 
> dimnames(x3)[[2]] [1] "LocatID"   "Region"    "Total"     "LocID"     "UTMX"  
>     "UTMY"      "Class"     "cat3_name" "EventID"   "day_sampl" "uniqueID" > 
> > x3_reg1 <- x3[x3$Region == "JELA_reg1",]> > ma1 <- ftable(xtabs(Total ~ 
> uniqueID + cat3_name, data=x3_reg1))> ma1                                    
> cat3_name Anthropogenic Asteraceae - herb Bare ground Canopy tree Coarse 
> woody debris Cypress knees Emergent aquatic Epiphyte Floating aquatics 
> Grasses Herbs Ilex Midstory tree Palm Sapium sebiferum Sedge Shrub 
> Terrestrial herb Vine WateruniqueID                                           
>                                                                               
>                                                                               
>                                                                    
> JELA_reg1_1_2_6554_2007Oct24_Class1                       0                 0 
>           0           0                   0             0               25    
>     0        !
          0       5     0    0             0    0                0    55     0  
             10    0     0JELA_reg1_1_3_6985_2007Oct17_Class2                   
    0                15           0           0                   0             
0               15        0                 0       0     5    0             0  
  0                0    50     7                0   10     0.
.
.
.
 
JELA_reg3_8_1_8015_2007Nov08_Class1                       0                 0   
        0           0                   0             0                0        
0                 0       0     0    0             0    0                0     
0     0                0    0     0JELA_reg3_9_2_8216_2007Nov08_Class1          
             0                 0           0           0                   0    
         0                0        0                 0       0     0    0       
      0    0                0     0     0                0    0     0> 
 
-----------------------
 
As you see instead of having only the uniqueID locations that belong only to 
region 1, i have all locations for both regions, 1 and 3. If i save on disk 
x3_reg1 and after read in back with read.csv and do the same xtabs on that i do 
have only the locations belonging to region 1. Do i really need this extra 
step? What i am doing wrong in my selection?
 
Thank you for your input,
 
Monica
_________________________________________________________________


GLM_CPC_VideoChat_distantfamily_012008
        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to