summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NAMESPACE1
-rw-r--r--R/readData.R42
-rw-r--r--man/read.odf.idframe.Rd40
-rw-r--r--man/read.xls.idframe.Rd3
4 files changed, 86 insertions, 0 deletions
diff --git a/NAMESPACE b/NAMESPACE
index fa778d3..932e976 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -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)}