How can I load an object into a variable name that I specify from an R data file?

前端 未结 7 2153
你的背包
你的背包 2020-11-28 19:50

When you save a variable in an R data file using save, it is saved under whatever name it had in the session that saved it. When I later go to load it from anot

7条回答
  •  执笔经年
    2020-11-28 20:33

    You could also try something like:

    # Load the data, and store the name of the loaded object in x
    x = load('data.Rsave')
    # Get the object by its name
    y = get(x)
    # Remove the old object since you've stored it in y 
    rm(x)
    

提交回复
热议问题