write.tmp.data <- function(A, B, comp_name) {
mainDir1 <- paste(tempdir(), "/1/", sep="")
mainDir2 <- paste(tempdir(), "/2/", sep="")
if(!file.exists(mainDir1) && !file.exists(mainDir2)) {
dir.create(file.path(mainDir1))
dir.create(file.path(mainDir2))
}
write.csv(A, file = paste(mainDir1, comp_name, sep=""), row.names=FALSE, col.names=FALSE)
write.csv(B, file = paste(mainDir2, comp_name, sep=""), row.names=FALSE, col.names=FALSE)
}
import.tmp.data <- function(comp_name) {
file1 <- paste(tempdir(), "/1/", comp_name, sep="")
file2 <- paste(tempdir(), "/2/", comp_name, sep="")
data1 <- read.csv(file1, stringsAsFactors=FALSE)
data2 <- read.csv(file2, stringsAsFactors=FALSE)
return(list(data1, data2))
}
delete.tmp.data <- function() {
file1 <- paste(tempdir(), "/1/", sep="")
file2 <- paste(tempdir(), "/2/", sep="")
filelist <- c(list.files(file1, full.names=TRUE), list.files(file2, full.names=TRUE))
for(i in filelist) {
file.remove(i)
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.