I want to create a data frame by extracting certain values from another data frame, for what I did was create 2 matrices de 875 obs
and% loop
with certain conditions: Finally, what I want is to extract the value of variable X2 when the variable X1="Project:", that is, the value of the row.
df <- data.frame("AREA"=1:875, "EVALUADOR", "NOMBRE_PROYECTO", "CALIFICACION")
df <- for(i in 1:length(df1)){
if(df1$X1 == "Proyecto:"){
df$NOMBRE_PROYECTO <- df1$X2
} else if(df1$X1 != "Proyecto:"){
df$NOMBRE_PROYECTO <- 0
}
}
however I have this error:
In if (df1 $ X1 == "Project:") {: the condition has length > 1 and only the first element will be used