On 09/01/2019 2:16 a.m., Troels Ring 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

You have those objects in your workspace. If you refer to them by name (e.g. typing Na, TOTAL, or WA), you'll see the ones in the workspace, not in your package. To avoid this message, clean up your workspace, so there's nothing there.


#  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

That likely means that they are the same in both places.



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?

Something changed them.

Duncan Murdoch


All best wishes

Troels Ring, MD

Aalborg


        [[alternative HTML version deleted]]

______________________________________________
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


______________________________________________
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel

Reply via email to