Learn R Programming

packDAMipd (version 1.1.0)

add_entries_sameuse_timepoint: Function to get sum of entries of resource per individual at diff timepoints if same cateogry has listed multiple time for same id of participant , this method comes in handy to get the sum

Description

Function to get sum of entries of resource per individual at diff timepoints if same cateogry has listed multiple time for same id of participant , this method comes in handy to get the sum

Usage

add_entries_sameuse_timepoint(
  use_data,
  timepointcol,
  timepointval,
  idcolumn,
  result_col
)

Value

the data with added sum of resource use

Arguments

use_data

the data where the observations are held

timepointcol

columnname in the data where the timepoints are noted

timepointval

which time point is considered now at which the descriptive analysis is done

idcolumn

id for each participant

result_col

name of the column where the sum of entries to be saved

Examples

Run this code
eg_data <- as.data.frame(list(no = c(1, 2, 3, 4),
mark_at_1 = c(12, 7, 23, 45), gender = c("M", "F", "M", "F"),
mark_at_2 = c(12, 34, 89, 45), trialarm = c("1","1","2","2"),
time = c(1,1,2,2), id = c(1, 1, 1, 2)))
add_entries_sameuse_timepoint(eg_data,  "time", 1, "id",
("mark_at_2"))

Run the code above in your browser using DataLab