diff options
author | Suraj Yerramilli | 2015-08-25 10:08:50 +0530 |
---|---|---|
committer | Suraj Yerramilli | 2015-08-25 10:08:50 +0530 |
commit | 90e2f57bd10a8f55cea07ce117635e3bd39765e6 (patch) | |
tree | db9a5b3117cca51f63d4f6266014b615dd3429f7 | |
parent | adbc35a68f59ea37c6e30ab539db416995738104 (diff) | |
download | SysID-R-code-90e2f57bd10a8f55cea07ce117635e3bd39765e6.tar.gz SysID-R-code-90e2f57bd10a8f55cea07ce117635e3bd39765e6.tar.bz2 SysID-R-code-90e2f57bd10a8f55cea07ce117635e3bd39765e6.zip |
Read from odf files functionality and updated documentation
-rw-r--r-- | NAMESPACE | 1 | ||||
-rw-r--r-- | R/readData.R | 42 | ||||
-rw-r--r-- | man/read.odf.idframe.Rd | 40 | ||||
-rw-r--r-- | man/read.xls.idframe.Rd | 3 |
4 files changed, 86 insertions, 0 deletions
@@ -52,6 +52,7 @@ export(oe) export(outputData) export(outputNames) export(read.idframe) +export(read.odf.idframe) export(read.table.idframe) export(read.xls.idframe) export(residplot) diff --git a/R/readData.R b/R/readData.R index 372013a..6729a1b 100644 --- a/R/readData.R +++ b/R/readData.R @@ -78,6 +78,8 @@ read.table.idframe <- function(file,header=TRUE,sep=",",ninputs=0, #' #' @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") @@ -117,4 +119,44 @@ read.xls.idframe <- function(file,sheetName,header=TRUE,ninputs=0, # 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) }
\ No newline at end of file diff --git a/man/read.odf.idframe.Rd b/man/read.odf.idframe.Rd new file mode 100644 index 0000000..f7a797a --- /dev/null +++ b/man/read.odf.idframe.Rd @@ -0,0 +1,40 @@ +% Generated by roxygen2 (4.1.1): do not edit by hand +% Please edit documentation in R/readData.R +\name{read.odf.idframe} +\alias{read.odf.idframe} +\title{Reading from .odf documents} +\usage{ +read.odf.idframe(file, sheetName, header = TRUE, ninputs = 0, Ts = 1, + unit = c("seconds", "minutes", "hours", "days")[1], ...) +} +\arguments{ +\item{file}{the path to the file to read} + +\item{sheetName}{a character string with the sheet name} + +\item{header}{a logical value indicating whether the first row corresponding to +the first element of the rowIndex vector contains the names of the variables.} + +\item{ninputs}{the number of input columns. (Default: 0)} + +\item{Ts}{sampling interval (Default: 1)} + +\item{unit}{Time Unit (Default: "seconds")} + +\item{...}{additional arguments to be passed to the \code{\link[xlsx]{read.xlsx2}} function} +} +\value{ +an idframe object +} +\description{ +Read the contents of an a .odf document into a \code{idframe} object. +} +\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 +} +\seealso{ +\code{\link[xlsx]{read.xlsx2}} +} + diff --git a/man/read.xls.idframe.Rd b/man/read.xls.idframe.Rd index 205d52c..449ccf9 100644 --- a/man/read.xls.idframe.Rd +++ b/man/read.xls.idframe.Rd @@ -12,6 +12,9 @@ read.xls.idframe(file, sheetName, header = TRUE, ninputs = 0, Ts = 1, \item{sheetName}{a character string with the sheet name} +\item{header}{a logical value indicating whether the first row corresponding to +the first element of the rowIndex vector contains the names of the variables.} + \item{ninputs}{the number of input columns. (Default: 0)} \item{Ts}{sampling interval (Default: 1)} |