MUCollective / multiverse

R package for creating explorable multiverse analysis
https://mucollective.github.io/multiverse/
GNU General Public License v3.0
62 stars 5 forks source link

variables named `df` in the globalenv() cannot be used/executed in the multiverse? #41

Closed abhsarma closed 4 years ago

abhsarma commented 5 years ago

This is currently throwing an error:

M = multiverse()
df <- data.frame(x = 1:10) %>% mutate( y = x^2 + sample(10:20, 10))
M$df <- ~ df %>%
      mutate( z = branch( value_y, 
                          "none" ~ y,
                          "log" ~ log(y)
                        ))

This throws an error as well:

M = multiverse()
df <- data.frame(x = 1:10) %>% mutate( y = x^2 + sample(10:20, 10))
M$df.s <- ~ df %>%
      mutate( z = branch( value_y, 
                          "none" ~ y,
                          "log" ~ log(y)
                        ))

However, this does not throw an error:

M = multiverse()
data.raw <- data.frame(x = 1:10) %>% mutate( y = x^2 + sample(10:20, 10))
M$df <- ~ data.raw %>%
      mutate( z = branch( value_y, 
                          "none" ~ y,
                          "log" ~ log(y)
                        ))
abhsarma commented 5 years ago

@mjskay I think this is assigning the stats function df here?

If so, solving #18 should address this as well?

mjskay commented 5 years ago

Yeah if I replace the initial .results environments in the multiverse table with the global environment it seems to work. So I would say those environments probably need to be adjusted to be child environments of the environment that first calls multiverse()

abhsarma commented 4 years ago

I am not able to replicate this error currently, so I assume that we'd solved this at some point

mjskay commented 4 years ago

Have you added a test for it? If not it would be a good idea so it doesn't come back

abhsarma commented 4 years ago

Sounds good