mardi 7 août 2018

How to use if statement to upload txt or csv file in r

I am uploading data but I want to upload text file or excel file using if statement. For example, enter code here
if(file == .txt){ df <- read.table(inFile$datapath, header = input$header) } else{ df <- read.csv(inFile$datapath, header = input$header, sep = input$sep, quote = input$quote) } Could anyone let me know what I need to use for if condition. Thank you.

Aucun commentaire:

Enregistrer un commentaire