From 08ec9591763da12c39dcc5da2f646a1114c64718 Mon Sep 17 00:00:00 2001 From: Suraj Yerramilli Date: Mon, 16 May 2016 10:39:06 +0530 Subject: minor changes --- NAMESPACE | 2 -- R/readData.R | 89 ------------------------------------------------------------ 2 files changed, 91 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index 00e1040..6993d08 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -57,9 +57,7 @@ export(optimOptions) export(outputData) export(outputNames) export(read.idframe) -export(read.odf.idframe) export(read.table.idframe) -export(read.xls.idframe) export(residplot) export(sim) export(spa) diff --git a/R/readData.R b/R/readData.R index 3c540fe..33c1dcb 100644 --- a/R/readData.R +++ b/R/readData.R @@ -67,95 +67,6 @@ read.table.idframe <- function(file,header=TRUE,sep=",",ninputs=0, # Read from file (default: csv file) dat <- read.table(file=file,header=header,sep=sep,...) - # read from dataframe and return idframe object - out <- read.idframe(dat,ninputs=ninputs,Ts = Ts,unit=unit) - return(out) -} - -#' Read the contents of a worksheet into a idframe object -#' -#' Read the contents of an excel worksheet into a \code{idframe} object. -#' -#' @param file the path to the file to read -#' @param sheetName a character string with the sheet name -#' @param header a logical value indicating whether the first row corresponding to -#' the first element of the rowIndex vector contains the names of the variables. -#' @param ninputs the number of input columns. (Default: 0) -#' @param Ts sampling interval (Default: 1) -#' @param unit Time Unit (Default: "seconds") -#' @param ... additional arguments to be passed to the \code{\link[xlsx]{read.xlsx2}} function -#' -#' @details -#' -#' The \code{read.xlsx.idframe} function uses the \code{\link[xlsx]{read.xlsx2}} function, -#' provided by the \pkg{xlsx} package, to read data from an excel file and then calls the -#' \code{\link{read.idframe}} function to read the data into a idframe object -#' -#' The function requires the java runtime to be installed on the system (Requirement of -#' the \pkg{xlsx} package). -#' -#' @return an idframe object -#' @examples -#' library(xlsx) -#' dataMatrix <- data.frame(matrix(rnorm(1000),ncol=5)) -#' colnames(dataMatrix) <- c("u1","u2","y1","y2","y3") -#' write.xlsx2(dataMatrix,file="test.xlsx",row.names=FALSE) -#' -#' data <- read.xls.idframe("test.xlsx","Sheet1",ninputs=2,unit="minutes") -#' -#' @seealso \code{\link[xlsx]{read.xlsx2}} -#' @export -read.xls.idframe <- function(file,sheetName,header=TRUE,ninputs=0, - Ts = 1,unit=c("seconds","minutes","hours", - "days")[1],...){ - - require(xlsx) - - # Read from file into an R data.frame - dat <- read.xlsx2(file=file,sheetName=sheetName,header=header,...) - l <- as.list(dat) - dat <- as.data.frame(sapply(l,as.numeric)) - - # read from dataframe and return idframe object - out <- read.idframe(dat,ninputs=ninputs,Ts = Ts,unit=unit) - return(out) -} - -#' Reading from .odf documents -#' -#' Read the contents of an a .odf document into a \code{idframe} object. -#' -#' @param file the path to the file to read -#' @param sheetName a character string with the sheet name -#' @param header a logical value indicating whether the first row corresponding to -#' the first element of the rowIndex vector contains the names of the variables. -#' @param ninputs the number of input columns. (Default: 0) -#' @param Ts sampling interval (Default: 1) -#' @param unit Time Unit (Default: "seconds") -#' @param ... additional arguments to be passed to the \code{\link[xlsx]{read.xlsx2}} function -#' -#' @details -#' -#' The \code{read.odf.idframe} function uses the \code{\link[gnumeric]{read.gnumeric.sheet}} function, -#' provided by the \pkg{xlsx} package, to read data from a .odf file and then calls the -#' \code{\link{read.idframe}} function to read the data into a idframe object -#' -#' @return an idframe object -#' -#' @seealso \code{\link[xlsx]{read.xlsx2}} -#' @export -read.odf.idframe <- function(file,sheetName,header=TRUE,ninputs=0, - Ts = 1,unit=c("seconds","minutes","hours", - "days")[1],...){ - - require(gnumeric) - - # Read from file into an R data.frame - dat <- read.gnumeric.sheet(file=file,sheet.name=sheetName, - head=header,...) - l <- as.list(dat) - dat <- as.data.frame(sapply(l,as.numeric)) - # read from dataframe and return idframe object out <- read.idframe(dat,ninputs=ninputs,Ts = Ts,unit=unit) return(out) -- cgit