I want to apply given function to each row of dataframe and use another values of row, as input parameters/arguments:
Model <- c("H5", "H5", "H5","H4")
Length <- c(6, 6, 6, 6)
Code <- c("030299", "010121","030448","030324")
df <- data.frame(Model,Length,Code)
Model Length Code
HS5 6 030299
HS5 6 010121
HS5 6 030448
HS4 6 030324
I want to apply the following code to each row and generate the outcome as a new column
Library(concordance)
concord(sourcevar = (each row of 'Code' column), origin = as.character(character in 'Model' column) , destination = "HS4", dest.digit = as.numeric(number in 'Length' column), all = F))
Documentation Page 6