## Objects x <- rnorm(30) y <- x[x>0] z <- x z[z<0] <- 0 m <- matrix(x, nrow = 5) str(m) d.f <- as.data.frame(m) str(d.f) m[2,2] = "a" d.f[2,2] = "a" str(m) str(d.f) ## Basic I/O and filehandling # Binary files save(m, file="my.file.with.m.R") rm(m) ls() load("my.file.with.m.R") ls() # Text files write.table(m, file="my.text.file.txt") write.csv(m, file="my.text.file.csv",row.names=F) rm(m) m <- read.table("my.text.file.txt") m2 <- read.csv("my.text.file.csv") str(m) str(m2) #m and m2 are data.frames! The old m was a matrix!