Please enable JavaScript.
Coggle requires JavaScript to display documents.
Unit-1: Introduction to R (R – Objects (Factors (apple_colors <- c('…
Unit-1: Introduction to R
R is a programming language and software environment for statistical analysis, graphics
representation and reporting.
R was created by Ross Ihaka and Robert Gentleman at the University of Auckland, New Zealand, and is currently developed by the R Development Core Team.
The core of R is an interpreted computer language and R made its first appearance in 1993.
Linux Installation
https://cran.r-project.org/bin/linux/
$ yum install R
$ R
R – Objects
Vectors
apple <- c('red','green',"yellow") >print(apple)
Lists
list1<-list(c(2,5,3),21.3,sin)
print(list1)
Matrices
M = matrix( c('a','a','b','c','b','a'), nrow=2,ncol=3,byrow = TRUE)
print(M)
Arrays
a <- array(c('green','yellow'),dim=c(3,3,2))
print(a)
Factors
apple_colors <- c('green','green','yellow','red','red','red','green')
factor_apple <- factor(apple_colors)
print(factor_apple)
print(nlevels(factor_apple))
Data Frames
BMI <- data.frame( gender = c("Male", "Male","Female"), height = c(152, 171.5, 165), weight = c(81,93, 78),Age =c(42,38,26) )
print(BMI)
R-Data Types
Logical
Numeric
Integer
Complex
Character
Raw
R – Variables
Variable Assignment
var.1 = c(0,1,2,3)
var.2 <- c("learn","R")
c(TRUE,1) -> var.3
Mind Map Prepared by: Srinivas Adapa
Associate Professor, CSE Department, CITM