This is an extension of the tidytuesday assignment you have already done. Complete the questions below, using the screencast you chose for the tidytuesday assigment.

Import data

library(purrr)

letters
##  [1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r" "s"
## [20] "t" "u" "v" "w" "x" "y" "z"

accumulate(letters, paste)
##  [1] "a"                                                  
##  [2] "a b"                                                
##  [3] "a b c"                                              
##  [4] "a b c d"                                            
##  [5] "a b c d e"                                          
##  [6] "a b c d e f"                                        
##  [7] "a b c d e f g"                                      
##  [8] "a b c d e f g h"                                    
##  [9] "a b c d e f g h i"                                  
## [10] "a b c d e f g h i j"                                
## [11] "a b c d e f g h i j k"                              
## [12] "a b c d e f g h i j k l"                            
## [13] "a b c d e f g h i j k l m"                          
## [14] "a b c d e f g h i j k l m n"                        
## [15] "a b c d e f g h i j k l m n o"                      
## [16] "a b c d e f g h i j k l m n o p"                    
## [17] "a b c d e f g h i j k l m n o p q"                  
## [18] "a b c d e f g h i j k l m n o p q r"                
## [19] "a b c d e f g h i j k l m n o p q r s"              
## [20] "a b c d e f g h i j k l m n o p q r s t"            
## [21] "a b c d e f g h i j k l m n o p q r s t u"          
## [22] "a b c d e f g h i j k l m n o p q r s t u v"        
## [23] "a b c d e f g h i j k l m n o p q r s t u v w"      
## [24] "a b c d e f g h i j k l m n o p q r s t u v w x"    
## [25] "a b c d e f g h i j k l m n o p q r s t u v w x y"  
## [26] "a b c d e f g h i j k l m n o p q r s t u v w x y z"

accumulate(1:10, ~ 2 * ., .init =1)
##  [1]    1    2    4    8   16   32   64  128  256  512 1024

Description of the data and definition of variables

I am explaing the same screencast I did last time and it’s the accumulate function. The code function accumulate(letters, paste) gives you the result and then the next value after that in each row. This function creats the Pascal’s Triangle. It is a triangular array of the binomial coefficient.

Visualize data

Hint: One graph of your choice. The Pascal’s Triangle

row <- c(1, 3, 3, 1)

accumulate(1:6, ~ c(0, .) + c(., 0), .init = 1)
## [[1]]
## [1] 1
## 
## [[2]]
## [1] 1 1
## 
## [[3]]
## [1] 1 2 1
## 
## [[4]]
## [1] 1 3 3 1
## 
## [[5]]
## [1] 1 4 6 4 1
## 
## [[6]]
## [1]  1  5 10 10  5  1
## 
## [[7]]
## [1]  1  6 15 20 15  6  1

What is the story behind the graph?

The story behind this is that this is the Pascal’s Triangle. A triangular array of the binomial coefficient. Each row corresponds and adds up with the coefficient. Also, the accumulate function is so powerful that it only took one line of coding to create it. Thats’s what the guyu screencasting said. The story behind the graph is that the accumulate function is making it so each row is summing adjacent elements.

Hide the messages, but display the code and its results on the webpage.

Write your name for the author at the top.

Use the correct slug.