getwd()[1] "/home/dw/rexrepos/tmp"setwd("d:/daniel/work/r/")Create some objects
Aval <- 7
Bval <- 15
Cval <- 10
ls() [1] "Aval" "Bval" "Cval" "dirMd" "dirR"
[6] "dirTmp" "fIn" "fName" "fOut" "markdEngine"
[11] "siteGen" List available objects
# objects in .GlobalEnv workspace that have a capital C in their name
ls(".GlobalEnv", pattern="C")character(0)exists("Bval")[1] TRUEexists("doesNotExist")[1] FALSERemove objects
Aval[1] 7rm(Aval)
Aval # this will give an errorError in eval(expr, envir, enclos): Objekt 'Aval' nicht gefunden## rm(list=ls(all.names=TRUE)) # remove all objects from the workspaceBval[1] 15print(Bval)[1] 15(Bval <- 4.5)[1] 4.5.Last.value[1] "nanoc"get("Bval")[1] 4.5varName <- "Bval"
get(varName)[1] 4.5ls() [1] "Bval" "Cval" "dirMd" "dirR" "dirTmp"
[6] "fIn" "fName" "fOut" "markdEngine" "siteGen"
[11] "varName" newNameVar <- "varNew"
assign(newNameVar, Bval)
varNew[1] 4.5search() [1] ".GlobalEnv" "package:stringr" "package:knitr"
[4] "package:stats" "package:graphics" "package:grDevices"
[7] "package:utils" "package:datasets" "Autoloads"
[10] "package:base" How R Searches and Finds Stuff
By default, savehistory() saves the command history to the file .Rhistory in the current working directory.
history()
savehistory("d:/daniel/work/r/history.r")By default, save.image() saves all objects in the workspace to the file .RData in the current working directory.
save.image("d:/daniel/work/r/objects.Rdata")R markdown - markdown - R code - all posts