sallyblockchain / Coursera-R-Programming

Repo for Coursera.com online course: R Programming
73 stars 434 forks source link

Regarding setting the directory #3

Open Prakhar1008 opened 6 years ago

Prakhar1008 commented 6 years ago

Can you please explain below statement: if(grep("specdata", directory) == 1) { directory <- ("./specdata/") print(directory) }

I have doubt in specifically understanding if(grep("specdata", directory) == 1).. Is it comparing "specdata" with the argument directory and if it's the same then directory being assigned to the current working directory?? Please reply asap.

richatripathi17 commented 5 years ago

if(grep("specdata", directory) == 1) // This statement is used to compare "specdata" in current working directory And other two statements are used to store data in directory vector that are present in specdata folder and print it.

I hope this will help you out.. Issue No. #3

ApoorvaUmesh commented 5 years ago

it is finding the first occurence of Specdata in Directory (if such a file exists), if yes then assigning "./specdata/" path to directory