Tokyo r18

20,292 views

Published on

TokyoR #18
初めてのR

Published in: Technology, Business
0 Comments
10 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
20,292
On SlideShare
0
From Embeds
0
Number of Embeds
15,889
Actions
Shares
0
Downloads
60
Comments
0
Likes
10
Embeds 0
No embeds

No notes for slide

Tokyo r18

  1. 1. TOKYO.R #18
  2. 2. 1. 2. 3.  R i.  ii.  iii.  demo()) iv.  v.  vi.  vii.  fucntion) viii. 4. 5.  Mac Windows
  3. 3. •  :•  Twitter :aad34210•  :http://pracmper.blogspot.com/•  :•  :•  : Web
  4. 4. •  R•  R• 
  5. 5. R• •  R …
  6. 6. • •  … TokyoR Amazon (¥3,990)
  7. 7. R - •  R http://www.r-project.org/
  8. 8. R - •  ������ R
  9. 9. R - •  … R ������ command + enter
  10. 10. R - quit() R R•  R•  R
  11. 11. R - •  iris•  R demo() demo(graphics)
  12. 12. R - •  Retern
  13. 13. R - • •  “Iris” iris head(iris , 10) tail(iris , 10)
  14. 14. R - •  • Iris$Sepal.Length Iris[,1] | iris[1,1] head(iris[,1] , 10) Iris[ , ] Iris
  15. 15. R – • •  R•  apply apply , , •  apply(iris[1:4] , 2 , sum)   •  apply(iris[1:4] , 2 , mean)   •  apply(iris[1:4] , 2 , sd)   •  apply(iris[1:4] , 2 ,quantile)  
  16. 16. R – • •  R•  apply apply , , •  apply(iris[1:4] , 2 , sum)   •  apply(iris[1:4] , 2 , mean)   •  apply(iris[1:4] , 2 , sd)   •  apply(iris[1:4] , 2 ,quantile)  
  17. 17. R – • •  tapply() tapply , , •  tapply(iris[,1] , iris[,5] , sum)   •  tapply(iris[,1] , iris[,5] , mean)   •  tapply(iris[,1] , iris[,5] , sd)   •  tapply(iris[,1] , iris[,5] , quantile)  
  18. 18. R – •  aggregate()•  aggregate( , , ) •  aggregate(iris[,1:4] , list(name = iris$Species) , sum)   •  aggregate(iris[,1:4] , list(name = iris$Species) , mean)   •  aggregate(iris[,1:4] , list(name = iris$Species) , sd)   •  aggregate(iris[,1:4] , list(name = iris$Species) , quantile)  
  19. 19. R – •  •  ggplot2 ”plyr” SQL ”sqldf”■ ggplot2 ■ sqldfddply(full_list, sqldf SELECTc("Subject","Class"), Species , function(df) COUNT(*) as numreturn(c(AVERAGE=mean(df FROM$RT)))) iris GROUP BY Species■ ■  http://cran.r-project.org/web/   http://code.google.com/p/sqldf/ packages/plyr/index.html   http://www.slideshare.net/aad34210/  http://plyr.had.co.nz/ tokyo-r-sqldf   TokyoR
  20. 20. R – •  sum() , mean()•  R Excel•  Sum() Sum(iris[,1]) Mean() Mean(iris[,1])sd() Sd(iris[,1]) Var() Var(iris[,1])Max() max(iris[,1])Min() Min(iris[,1])Rank() rank(iris[,1])Cor() cor(iris[,1] , iris[, 2])
  21. 21. R – • •  http://cran.r-project.org/doc/contrib/Short-refcard.pdf ������ Math ������ R Cheet Sheet
  22. 22. R – FUNCTION)•  R …• ������ function• judge_value <- function(v) { Judge_value z <- ifelse(v >= 0 , "+" , "-") v 0 print(z) }judge_value(v <- -10) −judge_value(v <- 10) +
  23. 23. R – FUNCTION)•  …•  Function()
  24. 24. R – •  R •    •  R■ R •  •  Install.packages() •  Vignettes • •  CRAN Task View •  http://cran.r-project.org/ web/views/•  •  http://cran.r-•  Twitter Facebook project.org/web/•  Yahoo! packages/zoo/ index.html
  25. 25. R – •  Install.packages()•  ggplot2 •  install.packages("ggplot2”) •  •  Library(ggplot2)
  26. 26. •  R•  R• • • • 
  27. 27. •  1.  CRAN R DL 2.  demo() 3.  iris , iris$Sepal.length , iris[1,1] , head(iris , 10) 4.  apply , aggregate , plyr , sqldf 5.  sum() , mean() , sd() … 6.  function() 7.  install.packages()
  28. 28. m(___)m

×