rticulate / import

An Import Mechanism For R
https://import.rticulate.org
Other
222 stars 14 forks source link

import function only for a specific environment #48

Closed vnijs closed 3 years ago

vnijs commented 3 years ago

I expected that in the code below the first and second count would reference dplyr but the third would show count to be part of the plyr package. Instead, the second count already refers to plyr.

Is my intended/expected import process possible with import?

env <- new.env(emptyenv())
attr(env, "name") <- "env"
library(dplyr)
count
import::from(plyr, count, .into = "env")
count
attach(env)
count
smbache commented 3 years ago

The syntax for importing into the env is

import::from(plyr, count, .into = {env})
vnijs commented 3 years ago

Nice! Thank you @smbache