GenerateComment: GenerateComment

View source: R/GenerateComment.R

GenerateCommentR Documentation

GenerateComment

Description

For all rows concerned by the condition, the function add a string in the chosen column of a data.table. If there is already a value, the string is pasted after the "/" separator.

Usage

GenerateComment(Data, condition, comment, column = "Comment")

Arguments

Data

Dataset (data.table)

condition

Vector of logicals

comment

The string to add in the column (character)

column

Column name to fill (character)

Value

The input data.table with the filled column.

Examples

## Not run: 
library(data.table)
dt <- data.table(A = c(2, 1, 3), B = c(6, 10, 6))

dt[A == 2,
   "information" := paste0("A = 2")] # 1st comment

GenerateComment(dt, condition = dt[,B] == 6, comment = "B = 6", column = "information")

## End(Not run)

VincyaneBadouard/TreeData documentation built on Jan. 4, 2024, 2:56 a.m.