observe.last: observe the last numeric value observed for any id in any...

Description Usage Arguments Value

View source: R/observe.last.R

Description

a long dataset (repeated measures within id) with a qualitative code (metric id) and its coresponding value will be reduced to just the last value of any set of codes before the deadline (index date)

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
observe.last(
  data,
  id,
  index.date,
  code,
  value,
  interval,
  valid.codes,
  text = F
)

Arguments

data

a data frame with a 'date' column, an index.date column, an id column, a code (metric id) column and a value column to be reduced to one row per id with the latest observation of any valid code.

id

name of id column.

index.date

name of index date column

code

name of column containing the metric id (when several metrics are just stacked in a long dataframe)

value

name of column with actual value corresponding to the label of metric contained in the code column

valid.codes

optional list of valid codes to weed out irrelevant measures

text

a boolean indicator of whether values are categorical / contains letters.

intervel

the limits of an interval expressed as integer days relative to the index date

Value

a data frame with one row per id and columns with counts of input vars within interval


socioskop/grit documentation built on Dec. 23, 2021, 3:30 a.m.