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

Dimitrios Rizopoulos Dimitris.Rizopoulos at med.kuleuven.be
Sat May 13 21:31:32 CEST 2006


the problem you get comes from the fact that you attach the 
data.frame, e.g., it can be re-produced by:

x1 <- rnorm(30)
dat <- data.frame(x1 = rnorm(30))
attach(dat)

look at ?attach for more details; you could consider with() as an 
alternative.

I hope it helps.

Best,
Dimitris


-- 
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
     http://www.student.kuleuven.be/~m0390867/dimitris.htm


Quoting Ben Fairbank <BEN at ssanet.com>:

> 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?
> 
>  
> 
> 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
> 
> 


Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm




More information about the R-help mailing list