Hi community
I would appreciate if you could help me, I am trying to add a column with the info from diferents columns.
For the example, I requered add thecolumn G with the specific text from the df. If the column A is == f then print in G "f" else Print for each row the column info in column B.
df<- data.frame("A" = c("a","f","f","a","a"),"B" = c("a","f","f","a","a"))
x<-c()
for (i in 1:length(df$A)) {
if(df$A[i] == "f" ){
DF$G[i] = "f"
} else{
df$G[i] <- df$B
}
}