Command | Description |
---|---|
wc | word count |
ls | list directory contents |
cd | change directory |
pwd | returns present working directory |
type | tells whether a command is built-in or a program |
rm | remove |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d1 <- density(rnorm(100)) | |
d2 <- density(rnorm(100)) | |
plot(range(d1$x, d2$x), range(d1$y, d2$y), type = "n", xlab = "x", | |
ylab = "Density") | |
lines(d1, col = "red") | |
lines(d2, col = "blue") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pb <- txtProgressBar(style = 3, min = 0, max = length(files_list)) | |
i <- 0 | |
for (file in files_list){ | |
i <- i+1 | |
setTxtProgressBar(pb, i) | |
do_computations() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install.packages("devtools") | |
# library(devtools) | |
# source_gist(6119745) | |
#' Example: | |
#' | |
#' data(tea) | |
#' newtea = tea[, c("Tea", "How", "how", "sugar", "where", "always")] | |
#' test <- MCA(newtea) | |
#' test <- add_modified_rates(test) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# first install devtools in R | |
# then run: | |
# install.packages("devtools") | |
# library(devtools) | |
# source_gist(6031243) | |
lapply(c("ggplot2", | |
"xtable", | |
"markdown", | |
"gdata", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(RCurl) | |
# code in the address | |
address <- 'ftp://user:[email protected]' | |
# get the list of files | |
items <- strsplit(getURL(address, .opts=curlOptions(ftplistonly=TRUE)), "\r\n")[[1]] | |
# download a file | |
download.file(paste0(address, "/",items[1]) , items[1]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require(FactoMineR) | |
# load data tea | |
data(tea) | |
# select these columns | |
newtea = tea[, c("Tea", "How", "how", "sugar", "where", "always")] | |
mca1 = MCA(newtea, graph = FALSE, ncp = 5) | |
# coordinates of the categories of the variables along the dimensions | |
y_kl <- mca1$var$coord |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##' @title f function | |
##' | |
##' f function | |
##' | |
##' @param x data | |
##' @param y data | |
##' @return data | |
##' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
result = tryCatch({ | |
expr | |
}, warning = function(w) { | |
warning-handler-code | |
}, error = function(e) { | |
error-handler-code | |
}, finally { | |
cleanup-code | |
} |
- Go to the "etc" folder under R program files folder.
- Locate Rconsole file.
- Find the line "language = ", change it to "language = en" if you want to run R in English.
- Save the modified file in another folder first, delete the original one and place the new in place.