readInputFile: Read the input data and creating the data structures

Description Usage Arguments Value Examples

View source: R/semmsFuncs.R

Description

Read a text file containing the response variable, any fixed effects (possibly none), and the putative variables. An intercept does not have to be in the data file - it can be added by this function. The function can also add all two-way interactions. The data may be loaded from an RData file, if is has been stored in the format that this function generates. The interaction terms are transformed using the scale function.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
readInputFile(
  file,
  skip = 0,
  header = TRUE,
  sep = "\t",
  ycol,
  Zcols,
  Xcols = c(),
  addIntercept = TRUE,
  logTransform = c(),
  twoWay = FALSE
)

Arguments

file

The input file name.

skip

How many lines to skip in the input file (default=0).

header

Does the first line being read contain column names? (default=TRUE).

sep

The delimiter (default is \t).

ycol

The number of the column in the input file which should be used as the response.

Zcols

The columns in the input file which contain the putative variables.

Xcols

The columns in the input file which contain the fixed effects in the model (default is none, c()).

addIntercept

Whether to add an intercept column to the fixed effects (default=TRUE).

logTransform

The column numbers which have to be log-transformed (default is none, c()).

twoWay

Whether to add all two-way interactions to the putative variables (default=FALSE).

Value

Z

A numeric matrix of putative variables (the columns of Z)

Y

The response vector

X

Fixed effects matrix (could be null)

originalZnames

The original names of the columns of the matrix Z

colnamesZ

The generated column names, Z0001, Z0002, etc.

N

The number of samples, nrow(Z)

K

The number of putative variables, ncol(Z)

P

The number of fixed effects, ncol(X)

Examples

1
2
3
4
5
## Not run: 
fn <- system.file("extdata", "ozone.txt", package = "SEMMS", mustWork = TRUE)
dataYXZ <- readInputFile(fn, ycol=2, Zcols=3:11,
addIntercept = TRUE, logTransform = 2, twoWay = TRUE)
## End(Not run)

haimbar/SEMMS documentation built on Dec. 20, 2021, 2:44 p.m.