I am trying to write this into a function:
dataFrAme[dataFrAme$x == "B" & dataFrAme$`Solvabiliteit: Hoog - Laag` == "Hoog",]
In my function below, I try to select rows based on 'id_type' and 'kern getal' type from a data frame (datframe). To do this I use a fixed column for id_type -> x in this case, and an input varable for the column that contains 'kern_getal_type'.
df_slct <- function(datframe,id_type,kern_getal_type){
datframe[(datframe$x == id_type) && (datframe$kern_getal_type == "Hoog"),]
}
This input of function is as follows:
df_selectie_risico(dataFrAme,"B",`Solvabiliteit: Hoog - Laag`)
It seems like the second argument in the fuction does not work: Warning message:
Unknown or uninitialised column: kern_getal_type
.
Does anyone know how to I can use the second column in subsetting the rows?