I saw some similar qestions and I tried to work it out on my own, but I couldn\'t. This is my problem:
I have to load a isfar.RData file to use it in other computati
you can try
isfar <- get(load('c:/users/isfar.Rdata'))
this will assign the variable in isfar.Rdata to isfar . After this assignment, you can use str(isfar) or ls(isfar) or head(isfar) to get a rough look of the isfar.
I think the problem is that you load
isfar
data.frame but you overwrite it by value returned by load
.
Try either:
load("C:/Users/isfar.RData")
head(isfar)
Or more general way
load("C:/Users/isfar.RData", ex <- new.env())
ls.str(ex)
You can also import the data via the "Import Dataset" tab in RStudio, under "global environment." Use the text data option in the drop down list and select your .RData file from the folder. Once the import is complete, it will display the data in the console. Hope this helps.
isfar<-load("C:/Users/isfar.RData")
if(is.data.frame(isfar)){
names(isfar)
}
If isfar is a dataframe, this will print out the names of its columns.
If you have a lot of variables in your Rdata
file and don't want them to clutter your global environment, create a new environment and load all of the data to this new environment.
load(file.path("C:/Users/isfar.RData"), isfar_env <- new.env() )
# Access individual variables in the RData file using '$' operator
isfar_env$var_name
# List all of the variable names in RData:
ls(isfar_env)
This may fit better as a comment but I don't have enough reputation, so I put it here.
It worth mentioning that the load()
function will retain the object name that was originally saved no matter how you name the .Rdata
file.
Please check the name of the data.frame object used in the save()
function. If you were using RStudio, you could check the upper right panel, Global Environment-Data, to find the name of the data you load.