@@ -48,6 +48,13 @@ Check for updated versions (more recent release tags) at https://gitlab.pasteur.
...
@@ -48,6 +48,13 @@ Check for updated versions (more recent release tags) at https://gitlab.pasteur.
#### WHAT'S NEW IN
#### WHAT'S NEW IN
## v4.5.0
1) fun_open_window() improved to deal with Linux systems
2) fun_graph_param_prior_plot() improved to deal with Linux systems
## v4.4.0
## v4.4.0
1) fun_dataframe_remodeling() now add a ini_rowname column in the output data frame when it is coherent and when initial row names are available (not NULL)
1) fun_dataframe_remodeling() now add a ini_rowname column in the output data frame when it is coherent and when initial row names are available (not NULL)
tempo.cat<-paste0("\n\n================\n\nERROR IN fun_open_window(): REQUIRED fun_param_check() FUNCTION IS MISSING IN THE R ENVIRONMENT\n\n================\n\n")
tempo.cat<-paste0("\n\n================\n\nERROR IN fun_open_window(): REQUIRED fun_param_check() FUNCTION IS MISSING IN THE R ENVIRONMENT\n\n================\n\n")
...
@@ -1570,29 +1571,51 @@ stop()
...
@@ -1570,29 +1571,51 @@ stop()
if(path.fun=="working.dir"){
if(path.fun=="working.dir"){
path.fun<-getwd()
path.fun<-getwd()
}else{
}else{
if(grepl(x=path.fun,pattern=".+/$")){
path.fun<-substr(path.fun,1,nchar(path.fun)-1)# remove the last /
}
if(dir.exists(path.fun)==FALSE){
if(dir.exists(path.fun)==FALSE){
tempo.cat<-paste0("\n\n================\n\nERROR IN fun_open_window(): path.fun ARGUMENT DOES NOT CORRESPOND TO EXISTING DIRECTORY\n\n================\n\n")
tempo.cat<-paste0("\n\n================\n\nERROR IN fun_open_window(): path.fun ARGUMENT DOES NOT CORRESPOND TO EXISTING DIRECTORY\n\n================\n\n")
stop(tempo.cat)
stop(tempo.cat)
}
}
}
}
if(Sys.info()["sysname"]=="Windows"){# Note that .Platform$OS.type() only says "unix" for macOS and Linux and "Windows" for Windows
if(Sys.info()["sysname"]=="Windows"){# Note that .Platform$OS.type() only says "unix" for macOS and Linux and "Windows" for Windows
tempo<-NULL
open.fail<-NULL
windows()
windows()
ini.par<-par(no.readonly=TRUE)# to recover the initial graphical parameters if required (reset)
ini.par<-par(no.readonly=TRUE)# to recover the initial graphical parameters if required (reset). BEWARE: this command alone opens a pdf of GUI window if no window already opened. But here, protected with the code bacause always a tempo window opened
invisible(dev.off())# close the new window
invisible(dev.off())# close the new window
}elseif(Sys.info()["sysname"]=="Linux"){
}elseif(Sys.info()["sysname"]=="Linux"){
if(!file.exists(paste0(getwd(),"/Rplots.pdf"))){
if(pdf.disp==TRUE){
tempo<-suppressWarnings(try(X11(),silent=TRUE))[]# open a X11 window or a pdf. So no need to use again X11(). tempo == NULL if no problem, meaning that the X11 window is opened. If tempo != NULL, a pdf is open here paste0(getwd(), "/Rplots.pdf")
ini.par<-par(no.readonly=TRUE)# recover the initial graphical parameters. Works even if X11 is not working as R opens a pdf
tempo.cat<-paste0("\n\n================\n\nPROBLEM IN fun_open_window(): THIS FUNCTION CANNOT BE USED ON LINUX IF A recover_ini_par.pdf FILE ALREADY EXISTS HERE: ",paste(path.fun,collapse=" "),"\n\n================\n\n")
invisible(dev.off())# can be used here to close the pdf windows if tempo != NULL and to close the X11 window if tempo == NULL
ini.par<-par(no.readonly=TRUE)# to recover the initial graphical parameters if required (reset). BEWARE: this command alone opens a pdf of GUI window if no window already opened. But here, protected with the code bacause always a tempo window opened
invisible(dev.off())# close the pdf windows
file.remove(paste0(path.fun,"/recover_ini_par.pdf"))# remove the pdf file
}
}else{
}else{
tempo.cat<-paste0("\n\n================\n\nPROBLEM IN fun_open_window(): THIS FUNCTION CANNOT OPEN GUI ON LINUX OR NON MACOS UNIX SYSTEM (X GRAPHIC INTERFACE HAS TO BE SET.\nTO OVERCOME THIS, PLEASE SET pdf.disp ARGUMENT TO TRUE AND RERUN\n\n================\n\n")
# test if X11 can be opened
if(file.exists(paste0(getwd(),"/Rplots.pdf"))){
tempo.cat<-paste0("\n\n================\n\nERROR IN fun_open_window(): THIS FUNCTION CANNOT BE USED ON LINUX IF A Rplots.pdf FILE ALREADY EXISTS HERE: ",getwd(),"\n\n================\n\n")
stop(tempo.cat)
stop(tempo.cat)
}else{
open.fail<-suppressWarnings(try(X11(),silent=TRUE))[]# try to open a X11 window. If open.fail == NULL, no problem, meaning that the X11 window is opened. If open.fail != NULL, a pdf can be opened here paste0(getwd(), "/Rplots.pdf")
if(is.null(open.fail)){
ini.par<-par(no.readonly=TRUE)# to recover the initial graphical parameters if required (reset). BEWARE: this command alone opens a pdf of GUI window if no window already opened. But here, protected with the code bacause always a tempo window opened
file.remove(paste0(getwd(),"/Rplots.pdf"))# remove the pdf file
tempo.cat<-("\n\n================\n\nPROBLEM IN fun_open_window(): THIS FUNCTION CANNOT OPEN GUI ON LINUX OR NON MACOS UNIX SYSTEM (X GRAPHIC INTERFACE HAS TO BE SET).\nTO OVERCOME THIS, PLEASE SET pdf.disp ARGUMENT TO TRUE AND RERUN\n\n================\n\n")
stop(tempo.cat)
}
}
}
}
}else{
}else{
tempo<-NULL
open.fail<-NULL
quartz()
quartz()
ini.par<-par(no.readonly=TRUE)# to recover the initial graphical parameters if required (reset)
ini.par<-par(no.readonly=TRUE)# to recover the initial graphical parameters if required (reset). BEWARE: this command alone opens a pdf of GUI window if no window already opened. But here, protected with the code bacause always a tempo window opened
invisible(dev.off())# close the new window
invisible(dev.off())# close the new window
}
}
zone.ini<-matrix(1,ncol=1)# to recover the initial parameters for next figure region when device region split into several figure regions
zone.ini<-matrix(1,ncol=1)# to recover the initial parameters for next figure region when device region split into several figure regions
...
@@ -1609,8 +1632,8 @@ pdf.loc <- NULL
...
@@ -1609,8 +1632,8 @@ pdf.loc <- NULL
if(Sys.info()["sysname"]=="Windows"){# .Platform$OS.type() only says "unix" for macOS and Linux and "Windows" for Windows
if(Sys.info()["sysname"]=="Windows"){# .Platform$OS.type() only says "unix" for macOS and Linux and "Windows" for Windows
stop("PROBLEM IN fun_open_window(): THIS FUNCTION CANNOT OPEN GUI ON LINUX OR NON MACOS UNIX SYSTEM (X GRAPHIC INTERFACE HAS TO BE SET.\nTO OVERCOME THIS, PLEASE SET pdf.disp ARGUMENT TO TRUE AND RERUN")
stop("\n\n================\n\nPROBLEM IN fun_open_window(): THIS FUNCTION CANNOT OPEN GUI ON LINUX OR NON MACOS UNIX SYSTEM (X GRAPHIC INTERFACE HAS TO BE SET).\nTO OVERCOME THIS, PLEASE SET pdf.disp ARGUMENT TO TRUE AND RERUN\n\n================\n\n")
tempo.cat<-paste0("\n\n================\n\nERROR IN fun_graph_param_prior_plot(): REQUIRED fun_param_check() FUNCTION IS MISSING IN THE R ENVIRONMENT\n\n================\n\n")
tempo.cat<-paste0("\n\n================\n\nERROR IN fun_graph_param_prior_plot(): REQUIRED fun_param_check() FUNCTION IS MISSING IN THE R ENVIRONMENT\n\n================\n\n")
...
@@ -1697,6 +1721,10 @@ stop()
...
@@ -1697,6 +1721,10 @@ stop()
}
}
# source("C:/Users/Gael/Documents/Git_versions_to_use/debugging_tools_for_r_dev-v1.2/r_debugging_tools-v1.2.R") ; eval(parse(text = str_basic_arg_check_dev)) ; eval(parse(text = str_arg_check_with_fun_param_check_dev)) # activate this line and use the function to check arguments status and if they have been checked using fun_param_check()
# source("C:/Users/Gael/Documents/Git_versions_to_use/debugging_tools_for_r_dev-v1.2/r_debugging_tools-v1.2.R") ; eval(parse(text = str_basic_arg_check_dev)) ; eval(parse(text = str_arg_check_with_fun_param_check_dev)) # activate this line and use the function to check arguments status and if they have been checked using fun_param_check()
# end argument checking
# end argument checking
if(is.null(dev.list())){
tempo.cat<-paste0("\n\n================\n\nERROR IN fun_graph_param_prior_plot(): THIS FUNCTION CANNOT BE USED IF NO GRAPHIC DEVICE ALREADY OPENED (dev.list() IS CURRENTLY NULL)\n\n================\n\n")
stop(tempo.cat)
}
if(param.reinitial==TRUE){
if(param.reinitial==TRUE){
if(!all(names(dev.cur())=="null device")){
if(!all(names(dev.cur())=="null device")){
active.wind.nb<-dev.cur()
active.wind.nb<-dev.cur()
...
@@ -1705,18 +1733,31 @@ active.wind.nb <- 0
...
@@ -1705,18 +1733,31 @@ active.wind.nb <- 0
}
}
if(Sys.info()["sysname"]=="Windows"){# Note that .Platform$OS.type() only says "unix" for macOS and Linux and "Windows" for Windows
if(Sys.info()["sysname"]=="Windows"){# Note that .Platform$OS.type() only says "unix" for macOS and Linux and "Windows" for Windows
windows()
windows()
ini.par<-par(no.readonly=TRUE)# to recover the initial graphical parameters if required (reset). BEWARE: this command alone opens a pdf of GUI window if no window already opened. But here, protected with the code bacause always a tempo window opened
invisible(dev.off())# close the new window
}elseif(Sys.info()["sysname"]=="Linux"){
}elseif(Sys.info()["sysname"]=="Linux"){
if(!file.exists(paste0(getwd(),"/Rplots.pdf"))){
if(file.exists(paste0(getwd(),"/Rplots.pdf"))){
tempo<-suppressWarnings(try(X11(),silent=TRUE))[]# open a X11 window or a pdf. So no need to use again X11(). tempo == NULL if no problem, meaning that the X11 window is opened. If tempo != NULL, a pdf is open here paste0(getwd(), "/Rplots.pdf")
tempo.cat<-paste0("\n\n================\n\nERROR IN fun_graph_param_prior_plot(): THIS FUNCTION CANNOT BE USED ON LINUX WITH param.reinitial SET TO TRUE IF A Rplots.pdf FILE ALREADY EXISTS HERE: ",getwd(),"\n\n================\n\n")
stop(tempo.cat)
}else{
open.fail<-suppressWarnings(try(X11(),silent=TRUE))[]# try to open a X11 window. If open.fail == NULL, no problem, meaning that the X11 window is opened. If open.fail != NULL, a pdf can be opened here paste0(getwd(), "/Rplots.pdf")
if(is.null(open.fail)){
ini.par<-par(no.readonly=TRUE)# to recover the initial graphical parameters if required (reset). BEWARE: this command alone opens a pdf of GUI window if no window already opened. But here, protected with the code bacause always a tempo window opened
ini.par<-par(no.readonly=TRUE)# to recover the initial graphical parameters if required (reset). BEWARE: this command alone opens a pdf of GUI window if no window already opened. But here, protected with the code bacause always a tempo window opened
invisible(dev.off())# close the new window
file.remove(paste0(getwd(),"/Rplots.pdf"))# remove the pdf file
}else{
}else{
tempo.cat<-paste0("\n\n================\n\nPROBLEM IN fun_graph_param_prior_plot(): THIS FUNCTION CANNOT OPEN GUI ON LINUX OR NON MACOS UNIX SYSTEM (X GRAPHIC INTERFACE HAS TO BE SET.\nTO OVERCOME THIS, PLEASE SET pdf.disp ARGUMENT TO TRUE AND RERUN\n\n================\n\n")
tempo.cat<-("\n\n================\n\nPROBLEM IN fun_graph_param_prior_plot(): THIS FUNCTION CANNOT OPEN GUI ON LINUX OR NON MACOS UNIX SYSTEM (X GRAPHIC INTERFACE HAS TO BE SET).\nTO OVERCOME THIS, PLEASE USE PDF GRAPHIC INTERFACES AND RERUN\n\n================\n\n")
stop(tempo.cat)
stop(tempo.cat)
}
}
}
}else{# macOS
}else{# macOS
quartz()
quartz()
}
ini.par<-par(no.readonly=TRUE)# to recover the initial graphical parameters if required (reset). BEWARE: this command alone opens a pdf of GUI window if no window already opened. But here, protected with the code bacause always a tempo window opened)
ini.par<-par(no.readonly=TRUE)# to recover the initial graphical parameters if required (reset)
invisible(dev.off())# close the new window
invisible(dev.off())# close the new window
}
if(!all(names(dev.cur())=="null device")){
if(!all(names(dev.cur())=="null device")){
dev.set(active.wind.nb)# go back to the active windows if exists
dev.set(active.wind.nb)# go back to the active windows if exists
par(ini.par)# apply the initial par to current window
par(ini.par)# apply the initial par to current window