summaryrefslogtreecommitdiff
path: root/R/readData.R
diff options
context:
space:
mode:
Diffstat (limited to 'R/readData.R')
-rw-r--r--R/readData.R36
1 files changed, 31 insertions, 5 deletions
diff --git a/R/readData.R b/R/readData.R
index 4893b6f..704223c 100644
--- a/R/readData.R
+++ b/R/readData.R
@@ -1,8 +1,6 @@
-# Reading from table-formatted files
-read.idframe(file,header=TRUE,sep=",",ninputs=1,
- type=c("time","freq")[1],Ts = 1,freqData=FALSE...){
- # Read from file (default: csv file)
- dat <- read.table(file=file,header=header,sep=sep,...)
+# Reading data from dataframes
+readData.idframe <- function(data,ninputs=1,type=c("time","freq")[1],
+ Ts = 1,freqData=FALSE){
if((type=="freq") && (freqData)){
@@ -20,4 +18,32 @@ read.idframe(file,header=TRUE,sep=",",ninputs=1,
out <- idframe(output=outputs,input=inputs,type=type,Ts=Ts)
}
+
+ return(out)
+}
+
+# Reading from table-formatted files
+read.idframe <- function(file,header=TRUE,sep=",",ninputs=1,
+ type=c("time","freq")[1],Ts = 1,freqData=FALSE,...){
+
+ # Read from file (default: csv file)
+ dat <- read.table(file=file,header=header,sep=sep,...)
+
+ # read from dataframe and return idframe object
+ out <- readData.idframe(data,ninputs=ninputs,type=type,Ts = Ts,freqData=freqData)
+ return(out)
+}
+
+# Reading from excel files
+readxls.idframe <- function(file,sheetName,header=TRUE,ninputs=1,
+ type=c("time","freq")[1],Ts = 1,freqData=FALSE,...){
+
+ require(xlsx)
+
+ # Read from file (default: csv file)
+ dat <- read.xlsx2(file=file,sheetName=sheetName,header=header,...)
+
+ # read from dataframe and return idframe object
+ out <- readData.idframe(data,ninputs=ninputs,type=type,Ts = Ts,freqData=freqData)
+ return(out)
} \ No newline at end of file