#Assignment 1 ##question 1
Seq1<-"ATCGGAGT"
seq2<-"AGC"
new_variable<-paste(Seq1,seq2,sep="")
new_variable
[1] "ATCGGAGTAGC"
substring<-substr(Seq1,2,5)
substring
[1] "TCGG"
#Question 2
x<-8
y<-10
add<-x+y
print(add)
[1] 18
Substract<-x-y
Substract
[1] -2
multiply<-x*y
multiply
[1] 80
divide<-x/y
divide
[1] 0.8
power<-x^y
power
[1] 1073741824
modulo<-x %% y
modulo
[1] 8
#Assignment 2 ## Question 2
exam_score = data.frame(
ID = c(1, 2, 3, 4, 5,6,7),
Name = c("Alice", "Bob", "David", "John", "Jenny","Jobran","Saikot"),
Age = c(20, 25, 30, 22, 18, 23, 25),
Score = c(100, 78, 90, 55, 81, 90, 95)
)
print(exam_score)
exam_score = data.frame(
ID = c(1, 2, 3, 4, 5,6,7),
Name = c("Alice", "Bob", "David", "John", "Jenny","Jobran","Saikot"),
Age = c(20, 25, 30, 22, 18, 23, 25),
Score = c(100, 78, 90, 55, 81, 90, 95),
Income=c(500,550,1000,6900,3888,8833,6777)
)
print(exam_score)
age<-exam_score[,3]
max(age)
[1] 30
min(age)
[1] 18
median(age)
[1] 23
sum(age)
[1] 163
mean(age)
[1] 23.28571
sd(age)
[1] 3.9036
var(age)
[1] 15.2381
quantile(age, probs = 0.25)
25%
21
score<-exam_score[,4]
max(score)
[1] 100
min(score)
[1] 55
median(score)
[1] 90
sum(score)
[1] 589
mean(score)
[1] 84.14286
sd(score)
[1] 14.91564
var(score)
[1] 222.4762
quantile(score, probs = 0.25)
25%
79.5
income<-exam_score[,5]
max(income)
[1] 8833
min(income)
[1] 500
median(income)
[1] 3888
sum(income)
[1] 28448
mean(income)
[1] 4064
sd(income)
[1] 3478.888
var(income)
[1] 12102665
quantile(income, probs = 0.25)
25%
775
cor(age,score)
[1] 0.1365809
cor(age,income)
[1] -0.1756726
cor(score,income)
[1] -0.2491914
output<-exam_score[exam_score$Score>=80,]
output
age_range<-exam_score[exam_score$Age>=20 & exam_score$Age<=30,]
age_range
#assignment 3 (project)
data<-seeds
new_data<-seeds
new_data$Type<-as.factor(new_data$Type)
data<-data[,-8]
plot(data$Area,data$Perimeter, xlab="Area", ylab="Perimeter", main=" Scatter plot",col.main = 'blue',
col.axis = 'red',
col.lab = 'cyan',)
hist(data$Perimeter,xlab="Perimeter", ylab="Frequency", main=" Histogram of Perimeter",col.main = 'blue',
col.axis = 'red',
col.lab = "yellow",)
boxplot(data$Perimeter,xlab="Perimeter", ylab="Frequency", main=" Boxplot of Perimeter",col.main = 'blue',
col.axis = 'red',
col.lab = 'green')
#6--
library(ggplot2)
ggplot(data, aes(x=data$Area,y=data$Perimeter))+
geom_point()+
geom_smooth()+
theme_bw()+
labs(title = "Area Vs Perimeter",
x = "Area",
y = "Perimeter")
ggplot(data, aes(x=data$Perimeter))+
geom_histogram()+
labs(title = " Perimeter",
x = "Area",
y = "Freuency")
ggplot(new_data, aes(x=new_data$Type,y=new_data$Kernel.Length, fill=Type))+
geom_boxplot()+
labs(title = " Kernel length",
x = "type",
y = "Kernel length")