Quick Guide to the RStudio User Interface
- Basic User Interface
- Use tab key for tab completion
- Changing the Default Working directory Tools -> General
- Changing the appearance of R Studio
- Navigate to Tools -> Global Options -> Appearance
- Navigate to Tools -> Global Options -> Appearance
- 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")
andlibrary(ggplot2)
to load the library - Packages tab
- Console =>
- What if i dont know what package i need Refer Here
- 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()
andtypeof()
function - To assign a variable some value
variable-name <- value
- 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
- 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
- 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
- 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)
- Logical: This represents the boolean value the valid values are
TRUE, FALSE,T, F
- Note: In R language, we can change the objects from one type to another using as.*() function. Refer below for usage
- Note: In R language, we can change the objects from one type to another using as.*() function. Refer below for usage
- Next Steps:
- Data Structures:
- Vectors
- Lists
- Matrices
- Dataframes
- Data Structures: