[R] What does it mean to be "masked from data" when attaching? (Newbie question)

Duncan Murdoch murdoch at stats.uwo.ca
Sun May 14 00:04:08 CEST 2006


On 5/13/2006 2:52 PM, Ben Fairbank wrote:
> I have several data frames, each with six variables and several hundred
> cases broken out from a larger dataframe by eleven values of a factor
> called "Division".  I have to perform the same analysis on each one.  I
> would like to do it by creating a data frame called data2 eleven times,
> once with data corresponding to each value of the factor, and performing
> the same analysis on each of the eleven values of data2.  However, when
> I assign to data2 the value of one of my data frames, e.g. data2 <-
> Florida, and then attach data2, I get the warning 
> 
>  
> 
>         The following object(s) are masked from data2 ( position 3 ) :
> 
>          Day Division SchedNo Spent TimeEnter TimeInStr 
> 
>         The following object(s) are masked from Alb3 :
> 
>          Day Division SchedNo Spent TimeEnter TimeInStr 
> 
>         The following object(s) are masked from data2 ( position 5 ) :
> 
>          Day Division SchedNo Spent TimeEnter TimeInStr 
> 
>  
> 
> I am having trouble finding an explanation of these messages, what the
> "position" refers to, and what it means to be "masked."  Can someone
> steer me to an online explanation?

It is the position in the search list.  See search() for the complete list.

It sounds as though you are attaching things, but not detaching them: 
and R is warning that the new attach is hiding something from the 
previous one.

The Introduction to R manual discusses this in the "Data frames" section 
of the "Lists and data frames" chapter.

Duncan Murdoch

> 
>  
> 
> And by the way, one of the analyses I have to perform is simply to
> tabulate the days of the week that occur in variable "Day" by using
> table(Day) which gives, for example,
> 
>  
> 
> Day
> 
>  Fri  Mon  Sat  Sun Thur  Tue  Wed 
> 
>  173  191  111   92  188  218  187
> 
>  
> 
> What is the proper syntax for doing that by levels of a factor within
> the large data frame containing all eleven factors?  I have
> unsuccessfully tried to use "by".
> 
>  
> 
> Thanks,
> 
>  
> 
> Ben F.
> 
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html




More information about the R-help mailing list