## Get a reference to the namespace for the 'base' package
getRegisteredNamespace("base")
## Create a namespace, and stuff something into it.
ns <- makeNamespace("myNamespace")
assign("test",7, env=ns)
ls(env=ns)
## Now grab a reference to the namespace we just defined
ns2 <- getNamespace("myNamespace")
## Now unregister the namespace
unregisterNamespace("myNamespace")
## Returns NULL if it is no longer defined
getRegisteredNamespace("myNamespace")
Run the code above in your browser using DataLab