add_statement.Rd
This function helps to add certain statements. A statement consists of a PID-QID combination that is added to a dataframe. The PID will be the column name, QID the row content.
It assumes there is a dataframe that has at least three columns: (1) statements
, (2) pid
, (3) qid
.
add_statement(
data = NULL,
available_statements = statements,
new_statement = NULL,
verbose = TRUE,
qid_from_row = FALSE,
col_for_row_content = NULL
)
dataframe to add the new column
dataframe with all statements that can be added with this method. It assumes there is a dataframe that has at least three columns: (1) statement
, (2) pid
, (3) qid
.
string of new statement. Must exist in available_statements$statement
. If statement is coordinates
, then a column longitude
and a column latitude
is expected.
show in terminal what was added
boolean; default FALSE
- then QID is taken from dataframe statements
, if TRUE
id QID value should be taken from another row
string; name of column in dataframe data
that contains the QID values
statements <- data.frame(statement = c("my_statement"), pid = c("P2"), qid = c("Q1"))
data <- data.frame(item = "my item")
data %>% add_statement(available_statements = statements, new_statement = "my_statement")
#>
#> ── add "my_statement" statement ────────────────────────────────────────────────
#> • PID = P2
#> • QID = Q1
#> item P2
#> 1 my item Q1