########### # R code for chapter 48 workspaces objects and history files. # Book details: # http://www.amazon.co.uk/Health-Science-Statistics-using-Commander/dp/190790431X ########### # list all objects ls() # list # deleting (removing) all objects rm(list = ls(all=TRUE)) # To remove all objects in your workspace except the one called nasty_one type: rm(list=setdiff(ls(), "nasty_one")) # search all the packages you have loaded search() # finding the structure of an objects # str(object_name) str(mydataframe) # 48.1 Saving and loading your workspace # saving: save.image("d:/mycurrentwork.rdata") # or save.image(file=file.choose()) # loading: load("d:/mycurrentwork.rdata") # or load(file=file.choose()) # loading from a website: load(url("http://www.robin-beaumont.co.uk/virtualclassroom/book2data/cummingp245.rdata")) # 48.2 Saving and loading your R commands - the history file # loading: loadhistory("d:/mycurrentwork.Rhistory") # saving: savehistory(file = "filename.Rhistory") # deleting default histroy file: # This file is called .Rhistory, # The file is usually located in the default working directory which you # can find by typing the command getwd() after you start R. ########## # Once you have quit R use your usual file browser to navigate to # the correct directory, select the .Rhistory file and then delete it