Gerekli Paketler
library(expss)
## Loading required package: maditr
##
## To drop variable use NULL: let(mtcars, am = NULL) %>% head()
##
## Use 'expss_output_rnotebook()' to display tables inside R Notebooks.
## To return to the console output, use 'expss_output_default()'.
##
## Attaching package: 'expss'
## The following object is masked from 'package:ggplot2':
##
## vars
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:expss':
##
## compute, contains, na_if, recode, vars, where
## The following objects are masked from 'package:maditr':
##
## between, coalesce, first, last
## The following object is masked from 'package:kableExtra':
##
## group_rows
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(tidyr)
##
## Attaching package: 'tidyr'
## The following objects are masked from 'package:expss':
##
## contains, nest
library(tibble)
library(haven)
##
## Attaching package: 'haven'
## The following objects are masked from 'package:expss':
##
## is.labelled, read_spss
library(sjlabelled)
##
## Attaching package: 'sjlabelled'
## The following objects are masked from 'package:haven':
##
## as_factor, read_sas, read_spss, read_stata, write_sas, zap_labels
## The following object is masked from 'package:dplyr':
##
## as_label
## The following object is masked from 'package:expss':
##
## read_spss
## The following object is masked from 'package:ggplot2':
##
## as_label
library(psych)
##
## Attaching package: 'psych'
## The following objects are masked from 'package:ggplot2':
##
## %+%, alpha
library(pastecs)
##
## Attaching package: 'pastecs'
## The following object is masked from 'package:tidyr':
##
## extract
## The following objects are masked from 'package:dplyr':
##
## first, last
## The following objects are masked from 'package:maditr':
##
## first, last
Veri Düzenleme
gather ()
- Gather fonksiyonu bir dizi sütunü, iki yeni sütuna dönüştürür.
genisveri<- midiPISA %>% select(OGRENCIID,ODOKUMA1:ODOKUMA5) #belli değişkenlerin seçilmesi
genisveri %>% head(6) # verinin ilk 6 satırının görüntülenmesi
uzun <- genisveri %>% gather(O_OD,okumapuan,ODOKUMA1:ODOKUMA5)
## Warning: attributes are not identical across measure variables; they will be
## dropped
uzun %>% arrange(OGRENCIID) %>% head(10)
spread ()
- Uzun veriden tekrar geniş veri olusturmaya yarar. Gtaher’in tersi şeklinde çalışır.
tekrar_genis <- uzun %>% spread(O_OD,okumapuan) # geniş veri oluşturulması
Pivot longer ve pivot wider
uzun <- genisveri %>% pivot_longer(names_to="okumapuan",values_to="deger",cols=ODOKUMA1:ODOKUMA5)
uzun %>% head(5)
- Uzun veri formatından geniş veri formatına dönüştürülmesi: pivot wider
genis<- uzun %>% pivot_wider(names_from="okumapuan",values_from="deger")
genis %>% head(5)
seperate
- Bir sütunu birden çok sütuna ayırır.
uzun_v1 <- uzun %>% separate(okumapuan, c("OD","Sayi"),"MA") # bir sütunu iki sütuna ayırma
uzun_v1 %>% head(3) #ilk üç satırın görüntülenmesi
unite
- seperate foksiyonun tam tersi şeklinde, iki sütunu alıp tek sütunda birleştirilmesinde kullanılır.
uzun_birles <- uzun_v1 %>% unite(ODOKUMA, OD, Sayi, sep = "_") # sütun birleştirmenin yapılması
uzun_birles %>% head(3) # ilk üç satırın görüntülenmesi
DeBruine, L., & Barr, D. (2022).
Data skills for reproducible research. Zenodo.
https://doi.org/10.5281/zenodo.6527194
R Core Team. (2022).
R: A language and environment for statistical computing. R Foundation for Statistical Computing.
https://www.R-project.org/
Xie, Y. (2016).
Bookdown: Authoring books and technical documents with R markdown. Chapman; Hall/CRC.
https://bookdown.org/yihui/bookdown
Xie, Y. (2022).
Bookdown: Authoring books and technical documents with r markdown.
https://github.com/rstudio/bookdown