X= Age Y= Height
X <- c(5,6,4,5,6)
Y <- c(4,4.2,3.8,4,4.2)
X
## [1] 5 6 4 5 6
Y
## [1] 4.0 4.2 3.8 4.0 4.2
plot(X,Y)
a <- 2:7
#b <- seq(2,5, by=0.5)
c <- rep(1:2, each=3)
a
## [1] 2 3 4 5 6 7
c
## [1] 1 1 1 2 2 2
p <- a+c
q <- a/c
p
## [1] 3 4 5 7 8 9
q
## [1] 2.0 3.0 4.0 2.5 3.0 3.5
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.6.1
##
## 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
## tidyverse
mtcars$mpg
## [1] 21.0 21.0 22.8 21.4 18.7 18.1 14.3 24.4 22.8 19.2 17.8 16.4 17.3 15.2 10.4
## [16] 10.4 14.7 32.4 30.4 33.9 21.5 15.5 15.2 13.3 19.2 27.3 26.0 30.4 15.8 19.7
## [31] 15.0 21.4
mtcars$hp
## [1] 110 110 93 110 175 105 245 62 95 123 123 180 180 180 205 215 230 66 52
## [20] 65 97 150 150 245 175 66 91 113 264 175 335 109
plot(mtcars$hp, mtcars$mpg)
library(readxl)
df <- read_excel("C:/Users/user/Downloads/HBV_Data_All.xlsx")
#df
mean(mtcars$mpg)
## [1] 20.09062
mean(mtcars$hp)
## [1] 146.6875
sd(mtcars$hp)
## [1] 68.56287
data(iris)
iris
str(iris)
## 'data.frame': 150 obs. of 5 variables:
## $ Sepal.Length: num 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ...
## $ Sepal.Width : num 3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ...
## $ Petal.Length: num 1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 ...
## $ Petal.Width : num 0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 ...
## $ Species : Factor w/ 3 levels "setosa","versicolor",..: 1 1 1 1 1 1 1 1 1 1 ...
View(iris)
a1 <- iris[,1:2]
a2 <- iris[,4:5]
a1
a2
b1 <- iris[1:20,]
b2 <- iris[40:60,]
b1
b2
cbind(a1,a2)
rbind(b1,b2)