Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.

Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.

Successfully reported this slideshow.

Like this presentation? Why not share!

- Programming in R by Smruti Sarangi 213 views
- R programming groundup-basic-section-i by Dr. Awase Khirni ... 453 views
- R programming language by Keerti Verma 596 views
- R programming Basic & Advanced by Sohom Ghosh 4974 views
- R programming by Shantanu Patil 9709 views
- An Interactive Introduction To R (P... by Dataspora 61145 views

12,644 views

Published on

The purpose of this presentation is to prepare you with all that you have to know about fundamentals of using R to operate data frames, which you can easily get by importing data from relational database table or csv/text file.

No Downloads

Total views

12,644

On SlideShare

0

From Embeds

0

Number of Embeds

10,978

Shares

0

Downloads

11

Comments

0

Likes

2

No embeds

No notes for slide

- 1. R and our platform Winston Chen @ Fliptop
- 2. Going to Cover Setting it up locally R very basics Our Current R Infrastructure MongoDB and MySql Integration The Follow-ups?
- 3. Installation On Your Local Come On! We are developers. http://cran.csie.ntu.edu.tw/ Just download it and install yourself.
- 4. Play with your RStudio
- 5. R Very Basics A bunch of functions and data types to work with data. - Not like C/java/scala/python. Don’t built products with it. - It works with Matrices, or super/sub types of it: - Vectors, Matrices, Data Frames… etc - So, Think in tabular ways. - All the operations based upon matrices.
- 6. R Data Types Atomic Vectors Matrix Lists Data Frame
- 7. Atomic Numeric: x = 10.55; class(x) Integer: y = as.integer(x); is.integer(y) Complex: z = 1 + 2i Logical: TRUE/FALSE Character: “nothing more than string” String concanation: paste(“Adam”, ”Smith”) [http://www.r-tutor.com/r-introduction/basic-data-types]
- 8. Vectors mylovelyvector <- c(2, 3, 5) Combining vectors: combined_vectors <- c(n, s) Indexing: mylovelyvector[1] Multiple Indexing: mylovelyvector[c(2,3)] Ranging: mylovelyvector[1:2] [http://www.r-tutor.com/r-introduction/vector]
- 9. Matrix > A = matrix( c(2, 4, 3, 1, 5, 7), # the data elements nrow=2, # number of rows ncol=3, # number of columns byrow = TRUE) >A # fill matrix by rows # print the matrix [,1] [,2] [,3] [1,] 2 4 3 [2,] 1 5 7
- 10. Matrix 2 Transpose: tA <- t(A) [http://www.r-tutor.com/r-introduction/matrix/matrixconstruction]
- 11. List A list is a generic vector containing other objects. n = c(2, 3, 5) s = c("aa", "bb", "cc", "dd", "ee") b = c(TRUE, FALSE, TRUE, FALSE, FALSE) x = list(n, s, b, 3) # x contains copies of n, s, b [http://www.r-tutor.com/r-introduction/list]
- 12. Data Frame Basically like a mysql table. Building one: n = c(2, 3, 5) s = c("aa", "bb", "cc") b = c(TRUE, FALSE, TRUE) df = data.frame(n, s, b)
- 13. Data Frame 2 head(df, n=10) names(df) df[2,3] df[2,] df[,1] df$s #df[,”s”]
- 14. Data Frame 3 Subsetting data frames: df[1] df[“s”] df[c("s", "b")] subset(df, n<=3) Adding two data frames together: combined <- rbind(df, df2) data <- read.csv("/Path/To/Ur/CSV/R_Example.csv", header=TRUE) [http://www.r-bloggers.com/select-operations-on-r-dataframes/]
- 15. Data Frame 4 We wanna explore data: select * from df where b=true can be translated into df_sub1 <- df[df$b==TRUE,] Then, the holy grail: something like sql join k = c('the','X','Men') s = c("aa", "bb", "cc") z = c(3.1415961, 124235243, 2309) df2 = data.frame(k, s, z) merged <- merge(df, df2, 's') #tada!!!
- 16. QA and Onward Who is up to a R study group? - Plotting (ggplot) - etc…

No public clipboards found for this slide

Be the first to comment