Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get environment identifier in R

I'm working with an environment, and I need the identifier of this environment. The function environmentName() doesn't work. It returns "", so how can I get the identifier of a environment?

Example:

a #this is a environment
<environment: 0xbc6d2bc>
environmentName(a)
""

I need this id "0xbc6d2bc".

Note: I didn't create the environment

like image 293
user2720097 Avatar asked Sep 19 '13 17:09

user2720097


People also ask

How do I get to environment variables?

On the Windows taskbar, right-click the Windows icon and select System. In the Settings window, under Related Settings, click Advanced system settings. On the Advanced tab, click Environment Variables.

How do I know my environment variable value?

In the Windows Environment In the command window that opens, enter echo %VARIABLE%. Replace VARIABLE with the name of the environment variable. For example, to check if NUKE_DISK_CACHE is set, enter echo %NUKE_DISK_CACHE%. If the variable is set, its value is displayed in the command window.

What is the environment in R?

The environment is a virtual space that is triggered when an interpreter of a programming language is launched. Simply, the environment is a collection of all the objects, variables, and functions. Or, Environment can be assumed as a top-level object that contains the set of names/variables associated with some values.


1 Answers

There might be a function that does this for you, but you can always just capture the output and extract that number yourself:

sub('<environment: (.*)>', '\\1', capture.output(a))

edit: there is a function in data.table that does this for you:

library(data.table)

address(a)
like image 63
eddi Avatar answered Nov 11 '22 20:11

eddi