Advertisement
Guest User

Untitled

a guest
Feb 20th, 2020
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. # -------------------------------------------
  2. # Beispiel 1
  3. # -------------------------------------------
  4.  
  5. #HierSindWirLULULU
  6. setwd(getwd()) #:^
  7.  
  8.  
  9. # get the name of the zipped file
  10. fname_zipped = "gtfs.zip"
  11.  
  12. # list all files names inside of a .zip file
  13. fnames = as.character(unzip(fname_zipped, list = TRUE)$Name)
  14.  
  15. # read every file into R, assuming they are .csv files
  16. lst = vector("list", length(fnames))
  17. for (i in seq_along(fnames)) {
  18. lst[[i]] = read.csv(unz(fname_zipped, fnames[i]), stringsAsFactors = F)
  19. }
  20.  
  21. #remove .txt cause kippodippobippo
  22. nameKame <- gsub(".txt", "CSV", fnames)
  23.  
  24. for(i in 1:length(lst)) {
  25. assign(paste0(nameKame[i]), lst[[i]])
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement