README.md

dpaudelR

Dev Paudel's commonly used R functions:

dpaudelR consists of some simple functions for data wrangling in R.

To install:

devtools::install_github("dpaudel/dpaudelR") 
# OR
install.packages("devtools")
library(devtools)
install_github("dpaudel/dpaudelR") 

To use:

library(dpaudelR)

Example uses

anova_hsd : This function performs single-factor ANOVA and outputs Tukey's HSD test as well as a barplot.

anova_hsd(user_model, dataset)
anova_hsd(Petal.Length~Species, iris)

anova_lsd : This function performs single-factor ANOVA and outputs LSD test as well as a barplot.

anova_lsd(user_model, dataset)
anova_lsd(Petal.Length~Species, iris)

copy2clipboard : This function copies a data frame to excel

copy2clipboard(dataframe)
# If the data is a list then follow this:
bind_rows(list) %>% copy2clipboard()
bind_rows(summary(model_nlm1)) %>% copy2clipboard()

copyFromExcel : This function copies data from Excel to R

# Ctrl + C a dataframe in Excel
data <- copyFromExcel()

data_transform : Transform data and plot histogram for log, log10, square root, and arcsine transformation

# data_transform(dataframe, 'column_name', numberOfBins)
data_transform(phenotype, 'Days_to_flower', 30)

diagnostics : Plot diagnostics in anova

diagnostics(residuals, fittedvalues)

dp_circlize_blast : Create a circos plot from blast output tablular format

test_blast1 <- read.table("blast_output_tabular_format.txt")
dp_circlize_blast(test_blast1)

hapMap2genlight2.R : Convert TASSEL hapmap file to genlight object for adegenet

mygeno=hapMap2genlight2(file.choose()) # choose hapmap file (remove # from rs# and assembly# on column names first)
mygeno1 <- mygeno[[1]] # genlight object for DAPC

merge_csv_files : Merge CSV files provided in a given directory recursively

merge_csv_files("directory_name","csv")
_merge_txt_files_ : Merge TXT files provided in a given directory recursively

merge_txt_files("directory_name","genomecov.txt")

_pin_ : Function to correct Standard Error of heritability estimates in ASREML (ASREML produces SE > 2)

pin(modelN, H2~V1/(V1+V2))

_plot_blast_segment_ : Function to give graphic output from blast results

plot_blast_segment(blast_output)

plot_blast_segment(read.table("blast_output_tabular.txt"))

_plot_gwas_snp_ : Function to give allele summary and plot in GAPIT

plot_gwas_snp(genotype_data,phenotype_data,'snp_name','phenotype_name')

myGDh <- read.table('hapmap_clean2.hmp.txt', head=FALSE)

plot_gwas_snp(myGDh,pheno_292,'2_25641','Days_to_flower')


_singlify_header_ : Function to create a single header from multiple header rows

singlify_header("filename", number of rows to skip, number of rows with headers)

singlify_header('Griffin_20200204/SCRI II Bermudagrass SSPN Griffin Final.xlsx', nskip=2,nheaders=4)


_theme_uf_ : GGplot2 theme for _University of Florida_ dissertation template


_write.list_dev_ : Function to write output of a list 

write.list_dev(file="data.txt", data_list, col.names = F, row.names = T, quote = F) ```



dpaudel/dpaudelR documentation built on June 12, 2025, 1:47 a.m.