library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.2.1     ✔ readr     2.2.0
## ✔ forcats   1.0.1     ✔ stringr   1.6.0
## ✔ ggplot2   4.0.3     ✔ tibble    3.3.1
## ✔ lubridate 1.9.5     ✔ tidyr     1.3.2
## ✔ purrr     1.2.2     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(readxl)
library(pastecs)
## 
## Attaching package: 'pastecs'
## 
## The following objects are masked from 'package:dplyr':
## 
##     first, last
## 
## The following object is masked from 'package:tidyr':
## 
##     extract
load("NSDUH_2023.Rdata")
pastecs::stat.desc(data$IRMARIT)
##                         x
## nbr.val      5.670500e+04
## nbr.null     0.000000e+00
## nbr.na       0.000000e+00
## min          1.000000e+00
## max          9.900000e+01
## range        9.800000e+01
## sum          6.946310e+05
## median       4.000000e+00
## mean         1.224991e+01
## SE.mean      1.204945e-01
## CI.mean.0.95 2.361700e-01
## var          8.232960e+02
## std.dev      2.869313e+01
## coef.var     2.342314e+00

The variable IRMARIT reflects marital status in the health survey reveals min 1.000000e+00
max 9.900000e+01
range 9.800000e+01
sum 6.946310e+05
median 4.000000e+00
mean 1.224991e+01

data<-data %>% drop_na("IRMARIT")
hist(data$IRMARIT)

data<-data %>% filter(IRMARIT>0)
head(data$IRMARIT)
## [1]  1  4  1 99  1  4
hist(data$IRMARIT)

data<-data%>%mutate(LOG_CFS=log(IRMARIT))%>%
select(IRMARIT,LOG_CFS)
head(data)
## # A tibble: 6 × 2
##   IRMARIT LOG_CFS
##     <dbl>   <dbl>
## 1       1    0   
## 2       4    1.39
## 3       1    0   
## 4      99    4.60
## 5       1    0   
## 6       4    1.39
hist(data$LOG_CFS)