Commit ac9c0bef authored by Holger Brandl's avatar Holger Brandl

* even more strict column name normalization

* added `toggle_plot_window`
parent 9b18cbab
...@@ -220,6 +220,8 @@ pretty_columns = function(df){ ...@@ -220,6 +220,8 @@ pretty_columns = function(df){
str_replace(fixed("["), "") %>% str_replace(fixed("]"), "") %>% str_replace(fixed("["), "") %>% str_replace(fixed("]"), "") %>%
str_replace("[_]+$", "") %>% str_replace("[_]+$", "") %>%
str_replace("^[_]+", "") %>% str_replace("^[_]+", "") %>%
## remove unicode characters
iconv(to='ASCII', sub='') %>% ## http://stackoverflow.com/questions/24807147/removing-unicode-symbols-from-column-names
tolower; tolower;
df df
} }
...@@ -522,3 +524,10 @@ assert <- function (expr, error) { ...@@ -522,3 +524,10 @@ assert <- function (expr, error) {
table_browser <- function(df, caption=deparse(substitute(df)), ...){ table_browser <- function(df, caption=deparse(substitute(df)), ...){
datatable(df, filter = "bottom", extensions = 'Buttons', options = list( dom = 'Bfrtip', buttons = c('copy', 'csv', 'excel')), caption=caption,...) datatable(df, filter = "bottom", extensions = 'Buttons', options = list( dom = 'Bfrtip', buttons = c('copy', 'csv', 'excel')), caption=caption,...)
} }
#prj_name = "env_data_prep"
prj_file = function(filename) {
## prefix a name with a project-prefix. Requires that prj_name to be defined
file.path(dirname(filename), paste0(prj_name, ".", basename(filename)))
}
...@@ -111,6 +111,9 @@ ggsave2 <- function(gplot=last_plot(), width=8, height=6, prefix="", saveData=FA ...@@ -111,6 +111,9 @@ ggsave2 <- function(gplot=last_plot(), width=8, height=6, prefix="", saveData=FA
return(fileName) return(fileName)
} }
## toggle active output device (see ggplot_devel.R for auto-toggeling plot)
toggle_plot_window = function() dev.set(dev.next())
######################################################################################################################## ########################################################################################################################
### pca plots (http://largedata.blogspot.de/2011/07/plotting-pca-results-in-ggplot2.html) ### pca plots (http://largedata.blogspot.de/2011/07/plotting-pca-results-in-ggplot2.html)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment