Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. Country,count
  2. uk,34
  3. au,35
  4. us,53
  5. in,44
  6.  
  7. args <- commandArgs()
  8. #Storing the filename in fn given next to "--args"
  9. fn <- args[which(args=="--args")+1]
  10. t<-read.table(fn,sep=",",header=TRUE,as.is=TRUE,quote="")
  11. t
  12. for (i in levels(t$Country)){
  13. if ( i == us ) {
  14. RES <<- t[t$Country == i,]
  15. }
  16. }
  17. RES
  18.  
  19. > args <- commandArgs()
  20. > #Storing the filename in fn given next to "--args"
  21. > fn <- args[which(args=="--args")+1]
  22. > t<-read.table(fn,sep=",",header=TRUE,as.is=TRUE,quote="")
  23. > t
  24. Country count
  25. 1 uk 34
  26. 2 au 35
  27. 3 us 53
  28. 4 in 44
  29. > for (i in levels(t$Country)){
  30. + if ( i == us ) {
  31. + RES <<- t[t$Country == i,]
  32. + }
  33. + }
  34. > RES
  35. Error: object 'RES' not found
  36. Execution halted
  37.  
  38. for (i in t$Country)
  39. if (i =="us")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement