R/fdaMatlabPath.R

Defines functions fdaMatlabPath

Documented in fdaMatlabPath

fdaMatlabPath <- function(R.matlab) {
##
## 1.  path2fdaM = path to ~R/library/fda/Matlab/fdaM
##
  path2fdaM <- system.file('Matlab/fdaM', package='fda')
##
## 2.  dirs2add = dirs(path2fdaM, ...)
##
  d2a. <- dirs(path2fdaM, exclude='^@|^private$',
             full.names=TRUE, recursive=TRUE)
  dirs2add <- c(path2fdaM, d2a.) 
##
## 3.  requires(R.matlab)?
##
  missRmat <- missing(R.matlab)
  if(missRmat)R.matlab <- TRUE 
  if(R.matlab){
    if(requireNamespace('R.matlab')){
      dirs2add <- c(system.file('externals', 
              package='R.matlab'), dirs2add)
    } else if(!missRmat)
        warning('Package R.matlab is not installed', 
                ' and can not be',
                ' included in the Matlab path.')
  }
##
## 4.  Create Matlab 'addpath' commands.
##
  d2a <- paste("addpath('", dirs2add, "');", sep='')
##
## 5.  write file
##
  writeLines(d2a, 'fdaMatlabPath.m')
##
## 6.  Done
##
  invisible(d2a)  
}

Try the fda package in your browser

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

fda documentation built on May 2, 2019, 5:12 p.m.