I am trying to print a subset of data based on the if statement in the code below. If I isolate the GcoReport[Company == Entities[1],] code it runs perfectly. However in the if statement it only gives me the value of Entities[1,]
GcoReport <- read.csv("GCO report.csv", header = TRUE, sep = "," ,dec = ".", fill = TRUE, blank.lines.skip = FALSE)
inputEntity = readline(prompt = 'Enter entity')
ListOfEntities <- data.frame(UniqueEntities = unique(GcoReport$Company))
Entities <- data.frame(ACYC = GcoReport[Company == Company[1],],
ARCI = ListOfEntities[2,],
AIH = ListOfEntities[3,],
ARE = ListOfEntities[4,],
ATCI = ListOfEntities[5,],
APH = ListOfEntities[6,],
CYCBR = ListOfEntities[7,],
COMESEC = ListOfEntities[8,],
IBERINF = ListOfEntities[9,],
GH = ListOfEntities[10,])
GcoReportEntityACYC <- GcoReport[Company == Company[1],]
if (inputEntity == "ACYC"){ GcoReport[Company == Entities[1,],]}
Aucun commentaire:
Enregistrer un commentaire