November 2016
Beginner to intermediate
959 pages
43h 46m
English
During data analysis, you will create several R objects. You can save these in the native R data format and retrieve them later as needed.
First, create and save R objects interactively as shown in the following code. Make sure you have write access to the R working directory:
> customer <- c("John", "Peter", "Jane")
> orderdate <- as.Date(c('2014-10-1','2014-1-2','2014-7-6'))
> orderamount <- c(280, 100.50, 40.25)
> order <- data.frame(customer,orderdate,orderamount)
> names <- c("John", "Joan")
> save(order, names, file="test.Rdata")
> saveRDS(order,file="order.rds")
> remove(order)After saving the preceding code, the remove() function deletes the object from the current session.
Read now
Unlock full access