...
Good afternoon. I want to check in R shiny after uploading 2 files if one part of the filename is identical or not. I have done this
data <- reactive({
inFile=input$bam
#str(inFile)
clean_file_1=str_extract_all(inFile, regex("[0-9]{3}[:punct:][0-9]{5}[:punct:][A-Z]{3}[0-9]{8}"))[[1]]
clean_file_2=str_extract_all(inFile, regex("[0-9]{3}[:punct:][0-9]{5}[:punct:][A-Z]{3}[0-9]{8}"))[[2]]
#a = clean_file_1 == clean_file_2
if (clean_file_1 == clean_file_2){
return(inFile)
} else {
print("Error message by Adam")
}
#validate(need(clean_file_1 == clean_file_2, print("Please upload the same Dna number pool1+pool2"))
})
Regex and comparison are correct when I checked out of shiny. The error message in Shiny is the following
Warning: Error in if: the argument is of length zero
When I try with validate does not accept the comparison symbol
The target is that if the 2 uploaded files have a small part of filenames identical to proceed the app if are not to prompt an error message suggesting to the user to be careful of what files he uploaded. Thank you