Data Science Classroom Series – 09/Dec/2021

Quick Guide to the RStudio User Interface

  • Basic User Interface Preview
  • Use tab key for tab completion
  • Changing the Default Working directory Tools -> General Preview
  • Changing the appearance of R Studio
    • Navigate to Tools -> Global Options -> Appearance Preview
  • When the R-Language was made available, there was lot of inbuilt functionality. R is a open source project.
  • Lot of people have solving complex problems & they wanted to share their code so that others can use it => This led to creation of packages and to make this packages available to other Comprehensive R Archive Network (CRAN) was made available
  • Lets install a package to understand how it works
    • Package will increase the functionality of R
    • Packages can be installed from console or from packages tab
      • Console => install.package("ggplot2") and library(ggplot2) to load the library
      • Packages tab Preview
    • What if i dont know what package i need Refer Here Preview
  • Activity-1: Set your preferred theme and font-size on your R-Studio
  • The activities of our work in class will be shared over here Refer Here

R-Programming Fundamentals

  • Variable Types:
    • Variables exist in all programming languages which tell the computer to store and access a variable/data
    • Variable created in R will have class and type. We can look into class or type of anything in R using the class() and typeof() function
    • To assign a variable some value variable-name <- value Preview
    • Class represents a broad categories such as character, number, integer and date. Whereas type elaborates more specifically on what the type of variable is double, character, POSIXct etc
  • Numeric and Integers:
    • The numeric data class includes all numbers except integer. Anything of numeric class will be of type double
    • If you want to create an Integer, you must type a capital letter L after the whole number Preview
  • Character
    • character data is always mentioned in quotation marks, anything thing in quotations is called character string. Usually character data has both class and type as character Preview
  • Dates
    • Dates are special type of data R and ared distinct from the date types POSIXct and POSIXlt, which represent the calender dates and times in more formal ways
    • Let create a date using the following code
    independence <- as.Date("1947-08-15")
    republic <- as.POSIXct("1950-01-26")
    typeof(independence)
    typeof(republic)
    class(independence)
    class(republic)
    
    Preview
  • Logical: This represents the boolean value the valid values are TRUE, FALSE,T, F Preview
    • Note: In R language, we can change the objects from one type to another using as.*() function. Refer below for usage Preview
  • Next Steps:
    • Data Structures:
      • Vectors
      • Lists
      • Matrices
      • Dataframes

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About learningthoughtsadmin