testing Quarto with R

1 author’s details

1.1 author’s image


kirit ved's image

image of kirit ved

1.2 kirit ved’s website


2 setting r environment

2.1 cleaning & initialising R environment

rm(list=ls(all.names = T))
setwd("d:/met/met_lect3")
set.seed(1234)

2.2 loading udf for R

me_start=function(){
  rm(list=ls(all.names=T))
  setwd("d:/met/met_lect3")
  set.seed(1234)
 
  if(!require("pacman")) {
    install.packages("pacman")
  }
  library("pacman")
   
}
me_stop=function(){
  p_unload(all)
  
  rm(list=ls(all.names=T))
}

2.3 loading required libraries

Loading required package: pacman
 [1] "kbv"       "psych"     "lubridate" "forcats"   "stringr"   "dplyr"    
 [7] "purrr"     "readr"     "tidyr"     "tibble"    "ggplot2"   "tidyverse"
[13] "pacman"   

3 generate data frame


A D E F G H I L P Q S T V W Z 
1 1 1 3 1 1 2 1 1 1 2 2 1 1 1 

4 plotting graphs

#theme_set(theme_classic()) 
 d$d4=factor(d$d4)
d|>ggplot(aes(d1,fill=d4))+geom_density()+labs(title="histogram of d1 vs d4",x="d1",y="density")+kbv::kbv_tmpx()

d|>ggplot(aes(d2,fill=d4))+geom_density()+labs(title="histogram of d2 vs d4",x="d2",y="density")+kbv::kbv_tmpx()

d|>ggplot(aes(d4,d1,fill=d4))+geom_boxplot()+labs(title="boxplot of d1 d4 wise ",x="d1",y="")+kbv::kbv_tmpx()

d|>ggplot(aes(d4,d2,fill=d4))+geom_boxplot()+labs(title="boxplot of d2 d4 wise ",x="d2",y="")+kbv::kbv_tmpx()

d|>ggplot(aes(d1,d2,color=d4))+geom_line()+geom_point(size=3)+labs(title="scatter plot of d2 vs d1 d4 wise ",x="d1",y="d2")+kbv::kbv_tmpx()

d|> dplyr::group_by(d4)|>dplyr::summarise(m=mean(d1))|>ggplot(aes(d4,m,fill=d4))+geom_col()+kbv::kbv_tmpx()