Save from Excel to disk as text





Load from disk into R

sets <- read.table("set1_set2.csv", header=TRUE)    # read from disk and store in variable "sets"
class(sets)
## [1] "data.frame"
dim(sets)
## [1] 300   2
head(sets)
##        set1     set2
## 1 1.8329159 3.730824
## 2 0.5397876 5.064780
## 3 1.2170686 5.958580
## 4 1.3883328 2.029921
## 5 1.7145705 2.378172
## 6 0.8423617 1.399623

Now you can run the analysis on that data:

colMeans(sets)  # mean value of each column
##      set1      set2 
## 0.8987499 3.9624399
t.test(sets[,1], sets[,2])
## 
##  Welch Two Sample t-test
## 
## data:  sets[, 1] and sets[, 2]
## t = -28.436, df = 527.39, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -3.275339 -2.852041
## sample estimates:
## mean of x mean of y 
## 0.8987499 3.9624399


Export from R to Excel

If the data were changed, the data frame can be written to Excel

library(WriteXLS)
WriteXLS("sets", ExcelFileName="new.xls", SheetNames=c("new.sheet"), row.names=TRUE)
file.exists("new.xls")
## [1] TRUE