class: title-slide <br> <br> .right-panel[ # First Steps in R ## Dr. Mine Dogucu ] --- class: middle center inverse .font150[hello woRld] --- class: middle center <video width="80%" height="45%%" align = "center" controls> <source src="screencast/01a-hello-world.mp4" type="video/mp4"> </video> --- class: inverse middle center .font100[R review] --- class: middle ## Object assignment operator ```r birth_year <- 1950 ``` -- | | Windows | Mac | |----------------------------|----------------|------------------| | Shortcut | Alt + - | Option + - | --- class: ## R is case-sensitive ```r my_age <- 2020 - birth_year My_age ``` ``` ## Error in eval(expr, envir, enclos): object 'My_age' not found ``` -- --- class: middle If something comes in quotes, it is not defined in R. ```r ages <- c(25, my_age, 32) names <- c("Menglin", "Mine", "Rafael") data.frame(age = ages, name = names) ``` ``` ## age name ## 1 25 Menglin ## 2 70 Mine ## 3 32 Rafael ``` --- ## Vocabulary ```r do(something) ``` `do()` is a function; `something` is the argument of the function. -- ```r do(something, colorful) ``` `do()` is a function; `something` is the first argument of the function; `colorful` is the second argument of the function. --- class: middle ## Getting Help In order to get any help we can use `?` followed by function (or object) name. ```r ?c ``` --- ## tidyverse_style_guide >canyoureadthissentence? -- .pull-right[ ```r age <- c(6, 9, 15) data.frame(age_kid = age) ``` ] -- .pull-left[ After function names do not leave any spaces. Before and after operators (e.g. <-, =) leave spaces. Put a space after a comma, **not** before. Object names are all lower case, with words separated by an underscore. ] --- class: middle center #### RStudio Setup <video width="80%" height="45%" align = "center" controls> <source src="screencast/01b-rstudio-setup.mp4" type="video/mp4"> </video>