1+1
## [1] 2
3+2
## [1] 5
3-1
## [1] 2
3*2
## [1] 6
3/2
## [1] 1.5
3^2
## [1] 9
x<-3
x
## [1] 3
3>4
## [1] FALSE
3>=4
## [1] FALSE
3==4
## [1] FALSE
!(3==4)
## [1] TRUE
TRUE&FALSE
## [1] FALSE
TRUE|FALSE
## [1] TRUE
a<-100
a<-"hello"
a<-100
a
## [1] 100
a<-c(1,2,3)
a
## [1] 1 2 3
mean(a)#a
## [1] 2
min(a)#a
## [1] 1
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
x<-c(1,2,3)
mode(x)
## [1] "numeric"
is.numeric(x)
## [1] TRUE
is.logical(x)
## [1] FALSE
is.character(x)
## [1] FALSE
length(x)
## [1] 3
a<-10
a
## [1] 10
class(x)
## [1] "numeric"
x<-c(1,10)
y<-c("apple","melon")
xy<-c(x,y)
1:5
## [1] 1 2 3 4 5
1:7
## [1] 1 2 3 4 5 6 7
gender<-c("male","female","male")
bloodtype<-c("AB","O","B")
height<-c(170,175,165)
weight<-c(70,65,55)
df<-data.frame(gender,bloodtype,height,weight)
df
## gender bloodtype height weight
## 1 male AB 170 70
## 2 female O 175 65
## 3 male B 165 55
car<-c("kia","bmw","toyota")
df2<-data.frame(df,car)
df2
## gender bloodtype height weight car
## 1 male AB 170 70 kia
## 2 female O 175 65 bmw
## 3 male B 165 55 toyota
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
summary(cars)
## speed dist
## Min. : 4.0 Min. : 2.00
## 1st Qu.:12.0 1st Qu.: 26.00
## Median :15.0 Median : 36.00
## Mean :15.4 Mean : 42.98
## 3rd Qu.:19.0 3rd Qu.: 56.00
## Max. :25.0 Max. :120.00
You can also embed plots, for example:
Note that the echo = FALSE parameter was added to the
code chunk to prevent printing of the R code that generated the
plot.