I have a data frame df which look like the following .
Now with my r shiny App i have to upload an excel file und save that data which has same column names .but some colums are totally empty ,som other contains one values and some others have more than one values .As said after saving this data .i want to filder the first data based on the values appearing on teh second (of course there will be no filtering by a certain column if its corresponding columns is empty).
Do not get surprised if you see that not all columns in the first image of the data frame are present in the second image of the data frame because the first one is big and i did not snipped every thing but be sure all columns by the second image are available by the first and not vice versa since the second one is designed only for filtration.
my code was like teh following. Although it was effecient locally but when deployed on the server does not work anymore:
files<-list.files(paste0(getwd(),"/","Melexist"),pattern=".xlsx")
df2<-list()
dat<- mergeddata
df1<-dat[dat$M_Datum >="2021-01-01" & dat$M_Datum <= "2021-01-03",]
for (i in 1:length(files)){
df2[[i]]<-readxl::read_excel(paste0(getwd(),"/","Melexist","/",files[i]))
for(f in names(df2[[i]])){
if(!is.na(df2[[i]][[f]]))
df1 <- df1[df1[[f]] %in% df2[[i]][[f]],]
}}