objects are masked _by_ '.GlobalEnv'

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

objects are masked _by_ '.GlobalEnv'

tring
Dear friends - this is really a question I'm sorry about since it doesn't
follow the requirements. I have made a R package via RStudio and it causes
problems when I try to load some data from within the package. I'm on
windows, R version 3.5.1 (2018-07-02).

 

When I am in the directory with the package project (also with plain R)

 

> data(Schell)

> library(chaRBAL)

 

Attaches package: 'chaRBAL'    my translation from Danish

 

The following objects are masked _by_ '.GlobalEnv':

 

    Na, TOTAL, WA

 

#  BUT: the  values are correct from data(Schell):

 

> Na

[1] 0.008 0.024 0.044 0.064 0.082 0.098 0.114 0.128 0.142 0.154 0.166 0.176
0.188 0.198 0.206 0.214 0.224 0.232

[19] 0.242 0.252 0.264 0.278 0.292 0.310 0.330 0.348 0.364 0.374 0.384 0.390

> TOTAL

       [,1]  [,2]

[1,] 0.004 0.098

[2,] 0.012 0.094

[3,] 0.022 0.089

[4,] 0.032 0.084

[5,] 0.041 0.079

----25 more so

> WA

$`buffs`

$`buffs`[[1]]

[1] "Phos"

 

$`buffs`[[2]]

[1] "Cit"

 

 

$KA

$KA[[1]]

[1] 6.918310e-03 6.165950e-08 4.786301e-13

 

$KA[[2]]

[1] 7.413102e-04 1.737801e-05 3.981072e-07

 

# Which is all OK

# But when now I make the same call again

 

 

> data(Schell)

ls()

# [1] "Alb"   "Ca"    "Cl"    "K"     "Lact"  "Mg"    "Na"    "PCO2"  "S1"


#[10] "TOTAL" "WA"  

 

TOTAL

#      [,1]   [,2]   [,3]

#   [1,] 0.0267 0.0267 0.0267

#   [2,] 0.0200 0.0200 0.0200

 

# which is wrong and belongs to another included dataset. How did that
happen to be caught in globalenvironment, how can I avoid that and get rid
# of it?

 

I can see I need to know more about environments. What do you think happens?

 

All best wishes

Troels Ring, MD

Aalborg


        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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 | Threaded
Open this post in threaded view
|

Re: objects are masked _by_ '.GlobalEnv'

Jeff Newmiller
There is a mailing list for questions about packages... see the Posting Guide.

On January 8, 2019 11:48:37 AM PST, Troels Ring <[hidden email]> wrote:

>Dear friends - this is really a question I'm sorry about since it
>doesn't
>follow the requirements. I have made a R package via RStudio and it
>causes
>problems when I try to load some data from within the package. I'm on
>windows, R version 3.5.1 (2018-07-02).
>
>
>
>When I am in the directory with the package project (also with plain R)
>
>
>
>> data(Schell)
>
>> library(chaRBAL)
>
>
>
>Attaches package: 'chaRBAL'    my translation from Danish
>
>
>
>The following objects are masked _by_ '.GlobalEnv':
>
>
>
>    Na, TOTAL, WA
>
>
>
>#  BUT: the  values are correct from data(Schell):
>
>
>
>> Na
>
>[1] 0.008 0.024 0.044 0.064 0.082 0.098 0.114 0.128 0.142 0.154 0.166
>0.176
>0.188 0.198 0.206 0.214 0.224 0.232
>
>[19] 0.242 0.252 0.264 0.278 0.292 0.310 0.330 0.348 0.364 0.374 0.384
>0.390
>
>> TOTAL
>
>       [,1]  [,2]
>
>[1,] 0.004 0.098
>
>[2,] 0.012 0.094
>
>[3,] 0.022 0.089
>
>[4,] 0.032 0.084
>
>[5,] 0.041 0.079
>
>----25 more so
>
>> WA
>
>$`buffs`
>
>$`buffs`[[1]]
>
>[1] "Phos"
>
>
>
>$`buffs`[[2]]
>
>[1] "Cit"
>
>
>
>
>
>$KA
>
>$KA[[1]]
>
>[1] 6.918310e-03 6.165950e-08 4.786301e-13
>
>
>
>$KA[[2]]
>
>[1] 7.413102e-04 1.737801e-05 3.981072e-07
>
>
>
># Which is all OK
>
># But when now I make the same call again
>
>
>
>
>
>> data(Schell)
>
>ls()
>
># [1] "Alb"   "Ca"    "Cl"    "K"     "Lact"  "Mg"    "Na"    "PCO2"
>"S1"
>
>
>#[10] "TOTAL" "WA"  
>
>
>
>TOTAL
>
>#      [,1]   [,2]   [,3]
>
>#   [1,] 0.0267 0.0267 0.0267
>
>#   [2,] 0.0200 0.0200 0.0200
>
>
>
># which is wrong and belongs to another included dataset. How did that
>happen to be caught in globalenvironment, how can I avoid that and get
>rid
># of it?
>
>
>
>I can see I need to know more about environments. What do you think
>happens?
>
>
>
>All best wishes
>
>Troels Ring, MD
>
>Aalborg
>
>
> [[alternative HTML version deleted]]
>
>______________________________________________
>[hidden email] mailing list -- To UNSUBSCRIBE and more, see
>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.

--
Sent from my phone. Please excuse my brevity.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.