#HAFTA 2
# paket yukleme
#install.packages("CTT")
#paket aktive etme
#library(CTT)
# temel paket fonksiyonlarina ulasimak icin
fonksiyonlar <- builtins()
length(fonksiyonlar)
## [1] 1393
fonksiyonlar[910:920]
## [1] "cut.Date" "cut" "curlGetHeaders" "cumsum"
## [5] "cumprod" "cummin" "cummax" "Cstack_info"
## [9] "crossprod" "cospi" "cosh"
#install.packages("tidyverse")
#library(tidyverse)
#install.packages("mcar", clean = TRUE)
#devtools::install_github("dr-JT/semoutput")
?is.na
## starting httpd help server ... done
help(sqrt)
#install.packages(CTT)
#library(CTT)
#ls("package:CTT")
#data(package = "CTT") # yeni bir sekmede acilir.
?reliability
## No documentation for 'reliability' in specified packages and libraries:
## you could try '??reliability'
#install.packages("MASS")
#library(dplyr)
#library(MASS)
#dplyr::select(data)
#MASS::select(data.class())
citation()
## To cite R in publications use:
##
## R Core Team (2023). _R: A Language and Environment for Statistical
## Computing_. R Foundation for Statistical Computing, Vienna, Austria.
## <https://www.R-project.org/>.
##
## A BibTeX entry for LaTeX users is
##
## @Manual{,
## title = {R: A Language and Environment for Statistical Computing},
## author = {{R Core Team}},
## organization = {R Foundation for Statistical Computing},
## address = {Vienna, Austria},
## year = {2023},
## url = {https://www.R-project.org/},
## }
##
## We have invested a lot of time and effort in creating R, please cite it
## when using it for data analysis. See also 'citation("pkgname")' for
## citing R packages.
citation("tidyverse")
## To cite package 'tidyverse' in publications use:
##
## Wickham H, Averick M, Bryan J, Chang W, McGowan LD, François R,
## Grolemund G, Hayes A, Henry L, Hester J, Kuhn M, Pedersen TL, Miller
## E, Bache SM, Müller K, Ooms J, Robinson D, Seidel DP, Spinu V,
## Takahashi K, Vaughan D, Wilke C, Woo K, Yutani H (2019). "Welcome to
## the tidyverse." _Journal of Open Source Software_, *4*(43), 1686.
## doi:10.21105/joss.01686 <https://doi.org/10.21105/joss.01686>.
##
## A BibTeX entry for LaTeX users is
##
## @Article{,
## title = {Welcome to the {tidyverse}},
## author = {Hadley Wickham and Mara Averick and Jennifer Bryan and Winston Chang and Lucy D'Agostino McGowan and Romain François and Garrett Grolemund and Alex Hayes and Lionel Henry and Jim Hester and Max Kuhn and Thomas Lin Pedersen and Evan Miller and Stephan Milton Bache and Kirill Müller and Jeroen Ooms and David Robinson and Dana Paige Seidel and Vitalie Spinu and Kohske Takahashi and Davis Vaughan and Claus Wilke and Kara Woo and Hiroaki Yutani},
## year = {2019},
## journal = {Journal of Open Source Software},
## volume = {4},
## number = {43},
## pages = {1686},
## doi = {10.21105/joss.01686},
## }
#RStudio.Version()
?rnorm
rnorm(20, mean = 6, sd = 0.5)
## [1] 5.756891 5.698576 5.593147 6.209483 6.111446 6.669385 6.410645 6.061812
## [9] 5.907118 5.828760 4.397876 5.911453 5.650422 5.874594 5.919769 6.792286
## [17] 5.788840 6.429181 5.631263 6.105407
set.seed(12042016)
rnorm(n = 5)
## [1] -0.2896163 -0.6428964 0.5829221 -0.3286728 -0.5110101
rnorm(n = 5, 8, 2.5)
## [1] 12.151066 7.222445 8.294326 7.764741 11.773877
#fonksiyonadi<- function(argumanlar ve olagan degerleri){
# kodlar
#return()
#}
sayi <- 4
sayi * sayi
## [1] 16
sayi ^2
## [1] 16
# kare alma fonksiyonu
kare_al <- function(sayi){
return(sayi*sayi)
}
kare_al(4)
## [1] 16
?return
#üs alma
üs_al<- function(x,us){
return(x^us)
}
üs_al(3,4)
## [1] 81
#üs alma
üs_al<- function(x,us=2){
return(x^us)
}
üs_al(3) # us argumanin olagan degeri olan
## [1] 9
myfunc <- function(x,y)
{
a <- x+y
b <- x* y
return(a*b)
}
myfunc(3,4)
## [1] 84
x <- c(1,2,3)
mean(x)
## [1] 2
x <- 1:1000
avg <- function(x){
sonuc <- sum(x)/length(x)
return(sonuc)
}
avg(x)
## [1] 500.5
identical(avg(x),mean(x))
## [1] TRUE
ls()
## [1] "avg" "fonksiyonlar" "kare_al" "myfunc" "sayi"
## [6] "üs_al" "x"
rm(alan)
## Warning in rm(alan): object 'alan' not found
#baş harfi b olan nesneleri silme
rm(list=ls(pattern = "^b"))
getwd()
## [1] "C:/Users/pc/Desktop/Rders/OLC731"
#setwd("C:/Users/pc/Desktop/Rders/OLC731")
# Kitap 1. Bölüm Alıştırmaları
#1
8+12
## [1] 20
8^2
## [1] 64
(5+5)/2
## [1] 5
sqrt(36)
## [1] 6
#2
8+12 #8 ile 12 toplamı
## [1] 20
8^2 #8'in karesi
## [1] 64
(5+5)/2 #bazen ne yaparsan yap başladığın yere geri dönersin
## [1] 5
sqrt(36) #36'nın karekökü
## [1] 6
#3
pi<-22/7
r1<-5
r2<-10
r3<-15
alan1<-pi*r1^2
alan1
## [1] 78.57143
alan2<-pi*r2^2
alan2
## [1] 314.2857
alan3<-pi*r3^2
alan3
## [1] 707.1429
#4
X <- 56
# a) μ = 40, σ = 4
mu <- 40
sigma1 <- 4
z_a <- (X - mu) / sigma1
z_a
## [1] 4
# b) μ = 40, σ = 8
sigma2 <- 8
z_b <- (X - mu) / sigma2
z_b
## [1] 2
# c) μ = 40, σ = 16
sigma3 <- 16
z_c <- (X - mu) / sigma3
z_c
## [1] 1
# d) μ = 40, σ = 32
sigma4 <- 32
z_d <- (X - mu) / sigma4
z_d
## [1] 0.5
#5
#install.packages("data.table")
#library(data.table)
#6
#7
getwd()
## [1] "C:/Users/pc/Desktop/Rders/OLC731"
#8
#setwd("C:/Users/pc/Desktop/REmre")
#9
set.seed(1000)
dagılım <- rnorm(100,5,10)
mean(dagılım)
## [1] 5.163792
sd(dagılım)
## [1] 10.06594
hist(dagılım)

