110 likes | 202 Views
Learn how to conduct reproducible research in R, from data collection to sharing results, with detailed explanations and code examples covering data types, complex objects, operations, and subsetting. Use the guide to efficiently create reports and easily replicate experiments all in one document. Quick introduction to the R language. Includes hands-on example using R and the KNITR library for report generation. Explore data sources and useful links for further learning.
E N D
Reprodukovatelnyvyskum Zaznamenavaniepriebehuanalyzydat Vytvaraniereportu Zdielanieudajov / zdrojovehokodupouzitehopri analyze / vysledkov Uplnainformaciapotrebna pre zopakovanieexperimentu v jednomdokumente
Rychly uvod do jazyka R Datovetypy: Character, Numeric, Integer, Logical Zlozeneobjekty: Vector, Matrix, Data frame, List, Factor Operacie: Subsetting, Logical Subsetting
Zlozeneobjekty Vector (aka. pole): heights <- c(188.2, 181.3, 193.4) heights ## [1] 188.2 181.3 193.4 List (aka. asociativne pole): vector1 <- c(188.2, 181.3, 193.4) vector2 <- c("jeff", "roger", "andrew", "brian") myList <- list(heights=vector1, firstNames=vector2) myList ## $heights ## [1] 188.2 181.3 193.4 ## ## $firstNames ## [1] "jeff" "roger" "andrew" "brian"
Zlozeneobjekty 2 Matrix: myMatrix = matrix(c(1, 2, 3, 4), byrow=T, nrow=2) myMatrix ## [,1] [,2] ## [1,] 1 2 ## [2,] 3 4
Zlozeneobjekty 3 Data frame (aka. tabulka): vector1 = c(188.2, 181.3, 193.4, 192.3) vector2 = c("jeff", "roger", "andrew", "brian") myDataFrame= data.frame(heights=vector1, firstNames=vector2) MyDataFrame ## heights firstNames ## 1 188.2 jeff ## 2 181.3 roger ## 3 193.4 andrew ## 4 192.3 brian
Subsetting vector1 = c(188.2, 181.3, 193.4, 192.3) vector2 = c("jeff", "roger", "andrew", "brian") myDataFrame = data.frame(heights=vector1, firstNames=vector2) vector1[1] ## [1] 188.2 vector1[c(1,2,4)] ## [1] 188.2 181.3 192.3
Subsetting 2 myDataFrame[1,1:2] ## heights firstNames ## 1 188.2 jeff myDataFrame$firstNames ## [1] jeff roger andrewbrian ## Levels: andrewbrianjeff roger
Logical subsetting myDataFrame[myDataFrame$firstNames == "jeff", ] ## heights firstNames ## 1 188.2 jeff myDataFrame$firstNames == "jeff" ## [1] TRUE FALSE FALSE FALSE myDataFrame[heights < 190, ] ## heights firstNames ## 1 188.2 jeff ## 2 181.3 roger ## 4 192.3 brian
Hands on Priklad s pouzitimjazyka R naanalyzu a kniznice KNITR nagenerovaniereportu o priebehuanalyzy
Odkazy Data http://blog.yhathq.com/posts/recommender-system-in-r.html http://www.ratebeer.com/beer/brewers/ RStudio http://www.rstudio.com/ Knitr (nastrojnagenerovaniereportov) http://yihui.name/knitr/ R https://class.coursera.org/compdata-003/class http://www.r-podcast.org/r-resources/