# Load necessary libraries
library(readr)
library(dplyr)

# Read the data file (replace "data.csv" with your actual file name)
data <- read_csv("data.csv")

# Function to detect outliers using Tukey's method
detect_outliers <- function(vector) {
  Q1 <- quantile(vector, 0.25)
  Q3 <- quantile(vector, 0.75)
  IQR <- Q3 - Q1
  lower_bound <- Q1 - 1.5 * IQR
  upper_bound <- Q3 + 1.5 * IQR
  
  outliers <- vector[vector < lower_bound | vector > upper_bound]
  return(outliers)
}

# Function to determine distribution type
determine_distribution <- function(vector) {
  skew <- skewness(vector)
  if (skew < -1) {
    return("Strongly Left Skewed")
  } else if (skew > 1) {
    return("Strongly Right Skewed")
  } else if (skew < 0) {
    return("Slightly Left Skewed")
  } else if (skew > 0) {
    return("Slightly Right Skewed")
  } else {
    return("Normal")
  }
}

# Iterate through columns
for (col in names(data)) {
  if (is.numeric(data[[col]])) {
    outliers <- detect_outliers(data[[col]])
    distribution <- determine_distribution(data[[col]])
    
    cat("Column:", col, "\n")
    cat("Distribution:", distribution, "\n")
    
    if (length(outliers) > 0) {
      cat("Outliers:", outliers, "\n")
    } else {
      cat("No outliers found.\n")
    }
    
    cat("\n")
  }
}

R相关代码片段

data table remove several columns R

how to reorder x axis labels in r ggplot2

how to open xlsx file in rstudio

how to remove last character in a string r

how to convert character to numeric in r

how to remove na in r

how to use pbbinom in r

unload library in R

convert long to wide in r

how to check r version in cmd

r read mtx

gumboot in r

unload package r

pinstall package in r

extract filename from path in r

Heatmap example

add limit in y axis in r ggplot geom bar

Add character value

Desactivar advertencias R

delete all objects except in R

¬ separator csv file in r

find position in string R

R move column to last using dplyr

Ways to Subset a Data Frame in R

change integer to factor in r

Rename factors levels

how to read a table in r

export excel with multiple sheets in r

Add a color to the bar chart in r language

R pull a vector out of a dataframe

r format of MIPS

Outliers in R

remove text between square brackets

r language gt save as png

R laguage dynamic varible create using for loop

the legend for the bars has points in it (in R)

arrange, filter and select in R

mutate columns in r

summarise number of rows with condition r

link columns titles with underscore in R

group by and count number of rows in r

count rows with condition in r

Count number of element in list R

R progerss: number of iteration replaces itself

save figure in r

nrow with specific value r

getting started with R studio

how to drop nas of an xts object

cross wavelet spectrum in r

plot line segment in multileve bar graph in r

Plot Raster Data in R

wavelet in R

r colorbar

faux package R mixed models

create file r

remove a package R

create data frame easily R

r get max value of column

how to update rlang

smarteda R

how to convert list column to a int column in r

filter by group condition R

scientific notation r

description R

log return calculation in R

how to read a dataset csv file in r

date column to row names R

not regex R stringr

all possible combinations of numbers in r

set a mirror R

if else if r

run after base::.First R

R run after loading base R

R string ends with

R trim stringr

get random lines r

type of var R

dataframe change type R dplyr

How to import data set in R language

calculate mode r