I am working on a database update form, modifying code from the following tutorial (it is a great tutorial by the way). https://ipub.com/shiny-crud-app/
One of the modifications that I have made is to include a responses table for each Database, the user selects the database from the selectInput. I am having a problem with the update and delete functions I will use the update function to illustrate.
This code works.
UpdateData <- function(data) {
data <- CastData(data)
TechSurveyResponses[row.names(eval(parse(text = paste(input$DatabaseName, "Responses", sep = "")))) == row.names(data), ] <<- data
}
when I try to make the dataframe name variable like this:
UpdateData <- function(data) {
data <- CastData(data)
eval(parse(text = paste(input$DatabaseName, "Responses", sep = "")))[row.names(eval(parse(text = paste(input$DatabaseName, "Responses", sep = "")))) == row.names(data), ] <<- data
}
I get this error.
Warning in file(filename, "r") :
cannot open file 'TechSurveyResponses': No such file or directory
Warning: Error in file: cannot open the connection
In programming languages that I am used to, I would just "house" the dataframe in a variable which links to the dataframe, in r the <- assignment of variables creates a whole new dataframe but I want to update the currently selected dataframe (which is going to be named a different name every time the user selects a different database). These are not predefined names either, datasets will be uploaded dynamically.