I am using Shiny Files to analyse the content from folders and this is the expression I use to obtain the folder path, the list of files in the folder and the length of that list.
folderInput1<- reactive({
shinyDirChoose(input, 'directory', roots= volumes, session=session, restrictions=system.file(package='base'))
return(parseDirPath(volumes, input$directory))})
files1 <- reactive({
list.files(path = folderInput1(), pattern = "*.csv", full.names = T)
})
nFiles1 <- reactive({ length(files1() ) })
I'm having trouble while trying to to use this information in data frames. This is what I am trying to do:
folder_df = data.frame(matrix(0,ncol = 4, nrow = nFiles1()))
I'm getting this error message:
Error in matrix(0, ncol = 4, nrow = nFiles1()) : non-numeric matrix extent