Some Useful Functions for Statistics and Visualization.
pcutils
pcutils
is a package that contains some useful functions for me, it offers a range of utilities and functions for everyday programming tasks.
The HTML documentation of the latest version is available at Github page.
Installation
The stable version is available on CRAN:
install.packages("pcutils")
Or you can install the development version of pcutils
from GitHub with:
# install.packages("devtools")
devtools::install_github("Asa12138/pcutils")
Little tools
lib_ps
,del_ps
can library or detach packages gracefullydabiao
print a messagedabiao("Message",char = "π",n = 20)
: ππππππMessageππππππcopy_vector
help to copy a vector, likedatapasta
package;copy_df
help to copy a dataframechange_fac_lev
can change a factor levels;tidai
can replace a vector by named vectorupdate_param
update a parameter in a functionsanxian
print a three-line tablegrepl.data.frame
andgsub.data.frame
do grepl and gsub on a dataframe.
for file
read.file
read some special format filestrans_format
convert file format like jpg, png, svg, pdf, htmlβ¦read_fasta
andwrite_fasta
read and write fasta file
for web
download2
download a file from a urldownload_ncbi_genome_file
download a file from NCBIsearch_browse
search and browse a websitetranslator
translate a text
Statistics
data preprocessing
remove.outliers
remove the outlierscount2
imitate theuniq -c
in shellhebing
group your dataframe;guolv
filter a dataframe;rm_low
remove low frequencytrans
transfer your datammscale
do a scale specifying the min and maxstrsplit2
is better thanstrsplit
for me;t2
is better thant
for meexplode
expand a column in dataframe;squash
squash a dataframepre_number_str
prepare a number string
statistical test
twotest
do a two-group test andmultitest
do a multi-group test;group_test
performs multiple mean comparisons for a data.framefittest
test a vector fit which distributiontoXY
transfer geographical latitude and longitude to XY(m)lm_coefficients
get the coefficients of a linear model;multireg
fit a multiple linear model
Visualization
utils for plot
rgb2code
convert between r,g,b and color code;is.ggplot.color
judge a right color;add_alpha
add a alpha for a colorplotpdf
,plotgif
print pdf or gif for a plot listget_cols
generate n colors based on a palette;scale_fill_pc
andscale_color_pc
are scales for ggplotadd_theme
generate a mytheme object for ggplotlegend_size
resize the legend for a ggplot;ggplot_lim
get the x-y limits for a ggplotgenerate_labels
generate points position for a series of labelsggplot_translator
translate the text of a ggplot
plot functions
stackplot
plot a bar plot or stack bar plot easily;areaplot
plot a area plot easilymy_sankey
plot a sankey plotcor_plot
plot a correlation plotgroup_box
plot a boxplot easilygghuan
plot a doughnut chart;gghuan2
plot a multi-doughnut chartmy_lm
fit a linear model and plotchina_map
plot a china map;sample_map
plot a sample mapgghist
plot a histogramvenn
plot a venn plottax_pie
plot a pie plottax_radar
plot a radar plotmy_circo
plot a circlize plot
my_sunburst
plot a sunburst plotmy_circle_packing
plot a circle packing plotmy_treemap
plot a treemap plotmy_voronoi_treemap
plot a voronoi treemap plot
Project
make_project
build a R projectadd_analysis
create a specific Rmd filemake_gitbook
build a git book
Package
prepare_package
prepare a packageupdate_NEWS_md
update the NEWS.md
Easter EggοΌ my_cat
will show my little cat named GuoDong.