Skip to content

Commit

Permalink
R script is sane!
Browse files Browse the repository at this point in the history
  • Loading branch information
hyiltiz committed Oct 19, 2015
1 parent 2139b16 commit d7c0724
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ vignettes/*.pdf
*.png

*.Rproj.user
.Rproj.user
*.Rproj
*.log
35 changes: 24 additions & 11 deletions vim-plugins-profile-plot.R
Original file line number Diff line number Diff line change
@@ -1,18 +1,31 @@
if("ggplot2" %in% rownames(installed.packages()) == FALSE) {

isOk <- FALSE
# we need to install the ggplot2 package
while(is.na(acr) | acr <= 0 | acr >= 1 ){
acr <- readline("and the average cancellation rate between 0 and 1 :")
acr <- ifelse(grepl("[^0-9.]",acr),-1,as.numeric(acr))
}
message("==========================================\n")
message("Installing required R dependency package...\n")
while(!isOk){
message("Trying in install the required R:ggplot2 package. Confirm? (y/n)")
ANSWER <- readLines(con="stdin", 1)
if (tolower(substr(ANSWER, 1,1)) == "y" ) {
isOk = TRUE
message("Confirmed to install.")
message(" ")
message("==========================================\n")
message("Installing required R dependency package...\n")

# install the required package if not present from the default package repository
install.packages("ggplot2", repos="http://cran.rstudio.com/")
message("Installation finished!\n")
message("==========================================\n")
# install the required package if not present from the default package repository
install.packages("ggplot2", repos="http://cran.rstudio.com/")
message("Installation finished!\n")
message("==========================================\n")
}
else {
isOk = FALSE
message("You did not say yes, so aborting.")
return(-1)
}
}
}


out <- tryCatch(
{
require(ggplot2)
Expand All @@ -24,7 +37,7 @@ out <- tryCatch(
dat.n <- aggregate(ExecTime ~ PluginName, data = dat, "sum")
dat.n <- dat.n[order(dat.n$ExecTime, decreasing = TRUE),]
dat.n <- dat.n[,2:1]
write.table(dat.n, "results.csv", sep = "\t", col.names = FALSE, row.names = FALSE)
write.table(dat.n, "results.csv", sep = "\t", row.names = FALSE)

},
error=function(cond) {
Expand Down

0 comments on commit d7c0724

Please sign in to comment.