I am trying to write back the results within a for loop to a new dataframe that i created. i would like to iterate through each row and then write the results to the last row on the data frame (lastrow + 1). Unfortunately, I am stuck and can't get the results to write-back.
#create a new dataframe
results<- data.frame(Fields=character(), Employee=character(), Plan=character())
a<-COMP30$PFRPrint_Has_Plan
b<-COMP30$PFRPrint_Is_Eligible
c<-COMP30$`Employee ID`
d<-results$Employee
matches<-cbind(a,b,c)
res<-cbind(d)
for (k in 1:nrow(matches)){
if (matches[k,1]==TRUE & matches[k,2]==FALSE){
results[nrow(results$Employee)+1,1]<-matches[k,3]
}
}