I have a ten input values names inputs$Art1,...,input$Art10 that I am using to update values in a data.frame. Rather than write versions of the below 10 times, once for each input, is there a way to make the input dynamic. I get an object not found error this way:
# sample arts data.frame
Status<-rep("Proposed",10)
Use.P<-rep(1,10)
Use.R<-rep(0,10)
arts<-data.frame(Status,Use.P,Use.R)
# loop attempt
arts.calc<-reactive({
for(i in 1:nrow(arts)){
if(get(paste0("input$Art",as.character(i)))=="Passed"){
arts$Status[i]="Passed"
arts$Use.P[i]<-0
}
if(get(paste0("input$Art",as.character(i)))=="Rejected"){
arts$Status[i]="Rejected"
arts$Use.P[i]<-0
arts$Use.R[i]<-1
}
}
return(arts)
})
Sorry if I missed an answer elsewhere in the messages.