Like this presentation? Why not share!

- Data Science Stack with MongoDB and... by Winston Chen 11680 views
- Spark with Elasticsearch - umd vers... by Holden Karau 1536 views
- R statistics with mongo db by MongoDB 8910 views
- Combine Apache Hadoop and Elasticse... by Hortonworks 40344 views
- 2014 spark with elastic search by Henry Saputra 6460 views
- Introduction to Apache Spark by Mohamed hedi Abidi 4196 views

11,493

-1

-1

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

11,493

On Slideshare

0

From Embeds

0

Number of Embeds

6

Shares

0

Downloads

6

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

×
### Save the most important slides with Clipping

Clipping is a handy way to collect and organize the most important slides from a presentation. You can keep your great finds in clipboards organized around topics.

Be the first to comment