Learn R Programming

usefun

A set of miscellaneous functions that I have used in various projects and in other R packages. Some of the most important are:

  • powerset_icounts(): find common (patient) ids in incomplete multi-omic datasets
  • get_roc_stats(): the ROC statistics the way you want it!
  • pr.test(): compare two PR curves (AUCs) and get a p-value!
  • pr.boot(): bootstrap CIs for PR curve
  • partial_permut(): get a partially-scrambled vector (you choose how much!)
  • normalize_to_range(): normalize a vector to a specified range
  • dec_to_bin(): convert a decimal (base-10) number to its binary representation
  • get_percentage_of_matches(): find the percentage of common elements between two vectors
  • outersect(): find the non-common elements between two vectors (outer-section!)
  • colors.100: a vector of 100 as much as possible distinct colors

Install

CRAN version:

install.packages("usefun")

Development version:

devtools::install_github("bblodfon/usefun")

Examples

See examples in the functions documentation and in the respective tests. For a full biomarker analysis that uses various functions from this package, see this report.

Copy Link

Version

Install

install.packages('usefun')

Monthly Downloads

243

Version

0.5.2

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

John Zobolas

Last Published

September 14th, 2024

Functions in usefun (0.5.2)

is_between

Is value between two others?
is_empty

Is object empty?
normalize_to_range

Range normalization
partial_permut

Get partial permutation of a vector
outersect

Outersect
pretty_print_vector_names_and_values

Pretty printing of a vector's names and values
get_common_values

Get the common values of two vectors
pretty_print_vector_values

Pretty printing of a vector's values
colors.100

100 distinct colors
binarize_to_thres

Binarize matrix to given threshold
make_multiple_density_plot

Multiple densities plot
powerset_icounts

Powerset Intersection Table
get_parent_dir

Retrieve the parent directory
save_mat_to_file

Save matrix to a specified file
ldf_arrange_by_rownames

Rearrange a list of data frames by rownames
pr.boot

Bootstrap Confidence Intervals for Precision-Recall Curves
pr.test

Compare two Precision-Recall curves
prune_columns_from_df

Prune single-value columns from a data frame
mat_equal

Matrix equality
remove_commented_and_empty_lines

Remove commented and empty lines
prune_rows_from_df

Prune single-value rows from a data frame
save_vector_to_file

Save vector to a specified file
save_df_to_file

Save data frame to a specified file
make_color_bar_plot

Make a color bar plot
prune_and_reorder_vector

Prune and reorder vector elements
print_empty_line

Print an empty line
add_row_to_ternary_df

Add a row to a 3-valued (ternary) data.frame
pretty_print_string

Pretty print a string
add_vector_to_df

Add vector to a (n x 2) data frame
pretty_print_vector_names

Pretty printing of a vector's names attribute
get_stats_for_unique_values

Get stats for unique values
get_ternary_class_id

Get ternary class id
pretty_print_bold_string

Pretty print a bold string
pretty_print_name_and_value

Pretty print a name and value
specify_decimal

Specify decimal
usefun

usefun
dec_to_bin

Convert decimal number to its binary representation
get_common_names

Get the common names of two vectors
get_percentage_of_matches

Get percentage of matches between two vectors
get_roc_stats

Generate ROC statistics