Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
jimrothstein committed Nov 26, 2024
1 parent 87c1022 commit 35079eb
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions envir/9009_namespace_example.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,23 @@ unloadNamespace("pharmaversesdtm")
### get pkg namespace

- asNamespace , returns \<environtment: namespace:stats\>
- a namespace is an *environment*
- as.environment, must include package: , returns \<environment: package:stats\> + attrs
- ns1, ns2 are both environments, but not the same

```{r}
asNamespace("stats") # do not prefix with "package:"
# <environment: namespace:stats>
ns1 =asNamespace("stats") # do not prefix with "package:"
ns1
is.environment(ns1) # T
as.environment("package:stats")
# package environment PLUS attributes
ns2 = as.environment("package:stats")
ns2
is.environment(ns2) #T
identical(ns1,ns2) # F
```

### getNamespace, returns environment
Expand Down

0 comments on commit 35079eb

Please sign in to comment.