Last active
August 24, 2016 20:23
-
-
Save janeshdev/9283622 to your computer and use it in GitHub Desktop.
Revisions
-
janeshdev revised this gist
Mar 1, 2014 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,6 @@ # Import files under folder name fawn # It is very important to include the option (full.names=TRUE). It it is not included # then you will get the error something like # "Error in file(file, "rt") : cannot open the connection In addition: Warning message: #In file(file, "rt") : cannot open file 'FAWN_2002.csv': No such file or directory -
janeshdev created this gist
Mar 1, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ # Import files under folder name fawn # It is very important to include the option (full.names=TRUE). It it is not included then you will get the error something like # "Error in file(file, "rt") : cannot open the connection In addition: Warning message: #In file(file, "rt") : cannot open file 'FAWN_2002.csv': No such file or directory mydata=ldply(list.files(path="data/fawn/",pattern="csv",full.names=TRUE),function(filename) { dum=read.csv(filename) dum$filename=filename return(dum) }) # If you are already in the root folder and you want to read csv files, you can simply do: mydata=ldply(list.files(pattern="csv"),function(filename) { dum=read.csv(filename) dum$filename=filename return(dum) })