R/WriteR.R

Defines functions WriteR IsWriteRAvailable

Documented in WriteR

.IsWriteRAvailable =
    function(){
      Success = FALSE
      if(reticulate::py_config()$version == "2.7" && reticulate::py_module_available("wx")){
        Success=TRUE
      }else{
        if(reticulate::py_config()$version == "2.7"){
          Success = .PullWxUsingPip
        }else{
          warning("This function requires installation of Python 2.7.\n")
        }
      }
      return(invisible(Success))
      }

# Running the WriteR application
# only for Windows users at present.

WriteR =
    function(file = NULL, math = c("webTeX", "MathJax")) {
      if (interactive()) {
        if (.Platform$OS.type == "windows") {
          if (.IsWriteRAvailable()) {
            if (!is.null(file)) {
              if (!file.exists(file)) {
                cat("Starting new file\n", file = file)
              }
            }
            shell(paste0('"', file.path(system.file(
                            "Python/WriteR/WriteR.pyw", package = "BrailleR")), '" ',
                        ifelse(is.null(file), "", file)))
          } else {
            warning(
                "This function requires an installation of Python 2.7 and wxPython.\n")
            message(
                "You could use GetPython27() and GetWxPython27() to help install them.\n")
          }
        } else {
          warning(
              "This function is for users running R under the Windows operating system.\n")
        }
      } else {
        warning("This function is meant for use in interactive mode only.\n")
      }
      return(invisible(NULL))
    }

Try the BrailleR package in your browser

Any scripts or data that you put into this service are public.

BrailleR documentation built on June 5, 2018, 9:04 a.m.