
If you use my suggestion and name it dat instead, then the mistake of not preloading your data will instead error with: mean(dat$x) (You can't do mean$x when referring to the mean function, for example.) Regardless, even though this here-modified error message is less confusing, it is still not clearly telling you what/where the problem is located.īecause of this, many seasoned programmers will suggest you use unique variable names (perhaps more than just x :-).


Meaning that though dat can be subsetted and dat$x means something, you cannot use the $ subset method on a function itself. In programming terms, a closure is a special type of function, so the error really should have said: # Error in data$x : object of type 'function' is not subsettable The problem is that if not previously defined as in your question, then data here refers to the function data. That error message is not immediately self-evident. # Error in data$x : object of type 'closure' is not subsettable
INKLING FRAME DATA CODE
If, however, you run some of your code without pre-loading your objects into your data variable, you'll likely get an error such as: mean(data$x) For instance, all of your code will work just fine as long as you load your data. Though you are certainly allowed to use that, it can bite you if you use variable names that match existing variables or functions. You may have noticed that I used dat as my variable name instead of data. There are some minor ramifications to not including that option, none of them earth-shattering.) myenv <- new.env(parent = emptyenv())ĭat = load("C:/Users/user/AppData/Local/Temp/1_29_923-Macdonell.RData",įrom here you can get at your data in any number of ways: ls.str(myenv) # similar in concept to str() but for environments (I use parent=emptyenv(), but that's not strictly required. If you want them to be not stored in the current environment, you can set up an environment to place them in. # either one of these on windows, NOT BOTHĭat = load("C:\\Users\\user\\AppData\\Local\\Temp\\1_29_923-Macdonell.RData")ĭat = load("C:/Users/user/AppData/Local/Temp/1_29_923-Macdonell.RData") You should immediately have access to them from where you called load(.).įor instance, if I can guess at variables you might have in your rda file: x This suggests (but admittedly does not state) that the true work of the load command is by side-effect, in that it inserts the objects into an environment (defaulting to the current environment, often but not always. If you read ?help, it says that the return value of load is:Ī character vector of the names of objects created, invisibly.
