Skip to content

How to load a specific variable from an RData file?

6 messages · Peng Yu, jim holtman, Charlie Sharpsteen

#
I'm wondering if there is any option available in load() such that I
can specify which variable I want to load from an RData file. I don't
see such option in the help.
#
Create an environment, load the RData file into the environment, copy
over the items of interest, delete the environment.
[1] "e1"
[1] "a.mark"               "aisleRange"           "allSlots"
   "balanced"
 [5] "baseSlots"            "box.offset"           "case2cube"
   "case2desc"
 [9] "caseupc2upc"          "ClassifyCommodity"    "colToUse"
   "comm.gold"
[13] "comm_map"             "comm2desc"            "commOrder"
   "createBay"
[17] "D_slots.save"         "DoubleCutoff"         "f.assignDouble"
   "f.assignSingle"
[21] "f.bayCheck"           "f.checkForGrowthSlot" "f.getBay"
   "f.removeSlot"
[25] "f.slotNum"            "f.sortSlots"          "firstSlot"
   "gold.comm"
[29] "growthInc"            "i"                    "KLN2comm"
   "KLN2cpq"
[33] "KLN2cube"             "KLN2desc"             "KLN2slot"
   "KLN2upc"
[37] "missingQuads"         "nfree"                "nSlots"
   "r.size"
[41] "rankComm"             "realign"              "report"
   "reslotAisles"
[45] "s.lower"              "s.mat"                "S_slots.save"
   "sa.m"
[49] "save.opt"             "save.slots"           "setupSlots"
   "slotAssignments"
[53] "slots"                "slotSize"             "slotsUsed"
   "slotWork"
[57] "topSlots"             "total"                "total.split"
   "upc2comm"
[61] "upc2crush"            "upc2cube"             "upc2desc"
   "upc2KLN"
[65] "upc2slot"             "upc2weight"           "upcDesc"
   "vol.report"
[69] "wh.reslot"            "x.aisle"              "x.m"
[1] "e1"    "nfree"
On Thu, Nov 5, 2009 at 6:43 PM, Peng Yu <pengyu.ut at gmail.com> wrote:

  
    
#
Thank you. When the RData file is huge, it will take a long time to
load it even though I may only need a small variable. Could somebody
add an option to 'load()' to load only a few given variables?
On Thu, Nov 5, 2009 at 5:58 PM, jim holtman <jholtman at gmail.com> wrote:
#
Peng Yu wrote:
Check out the "filehash" package. It has an option that allows you to store
variables in single-file databases just like RData files.  However, with
filehash data files, you can pick and choose which variables to load.

Hope this helps!

-Charlie

-----
Charlie Sharpsteen
Undergraduate
Environmental Resources Engineering
Humboldt State University
#
On Thu, Nov 5, 2009 at 5:58 PM, jim holtman <jholtman at gmail.com> wrote:
How to remove the environment 'e1' after I get 'nfree'?
#
Peng Yu wrote:
Did you try rm( e1 ) ?

-----
Charlie Sharpsteen
Undergraduate
Environmental Resources Engineering
Humboldt State University