lift: Linear fitting with interactive data selection

Description Usage Arguments Value Note Author(s) Examples

View source: R/lift.r

Description

The function fits linear models to a subset of data that is interactively selected from a scatter plot.

Usage

1
2
lift(df, time = "time", value = "value", keys = c("ID"), trans = log,
  ylim = c(NA, NA))

Arguments

df

A data frame with columns specified in the other arguments.

time

Name of the column of df holding numeric times corresponding to observations. Should be a character string.

value

Name of the column of df holding the observed time dependent quantity, e.g. optical density. Should be a character string.

keys

Name(s) of the column(s) of df that define subsets of the data to be analyzed separatety. Should be a vector of character strings which can be of length one. The specified columns should be of type character, integer, or factor. They typically hold experiment IDs and/or replicate IDs.

trans

A function that is applied to the data in the value column of df. The default, log, is useful for microbial growth data, for example.

ylim

A numeric vector of length 2 specifying the lower and upper limit for the value axis, respectively. Note that the values must be supplied in the transformed scale if trans is used. If one of the values is set to NA, the corresponding axis limit is computed from the data.

Value

A data frame with one row for each unique combination of the key columns of df. The number of columns is length(keys) plus 5. The contents of the additional columns is as follows:

Note

A plot is created for each subset of the data and the user is asked to select a (time) range on the x-axis by two sebsequent clicks with the left mouse button. The selected data points are highlighted and the fitted models are displayed. The selection can be corrected by repeating the two subsequent left-clicks. A click with the right mouse button (or pressing the 'finish' button in Rstudio) accepts the current result and the process continues with the next subset of the data (i.e. the next plot). The results is returned after all subsets were processed. Since the function does not return intermediate output you better call it for smaller data sets (e.g. < 100 plots) only. This avoids the loss of too much manual work in case of a crash, blackout, ...

Author(s)

David Kneis david.kneis@tu-dresden.de

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Not run: 
d <- read.table(header=TRUE, sep="", text='
  ID  time  value
  1   1     1
  1   2     10
  1   3     150
  1   4     900
  2   1     NA
  2   2     NA
  2   3     NA
  3   1     2
  3   2     33
  3   3     180
  3   4     3500
')
print(lift(d))

## End(Not run)

dkneis/knut documentation built on Jan. 7, 2020, 4:27 a.m.