Learn R Programming

⚠️There's a newer version (0.5.2) of this package.Take me there.

usefun

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

  • get_roc_stats(): the ROC statistics the way you want it!
  • pr.test(): compare two PR curves (AUCs) and get a p-value!
  • 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

310

Version

0.5.0

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

John Zobolas

Last Published

September 17th, 2023

Functions in usefun (0.5.0)

mat_equal

Matrix equality
partial_permut

Get partial permutation of a vector
pr.test

Compare two Precision-Recall curves
specify_decimal

Specify decimal
usefun

usefun
prune_columns_from_df

Prune single-value columns from a data frame
pretty_print_bold_string

Pretty print a bold string
prune_rows_from_df

Prune single-value rows from a data frame
pretty_print_name_and_value

Pretty print a name and value
remove_commented_and_empty_lines

Remove commented and empty lines
save_df_to_file

Save data frame to a specified file
print_empty_line

Print an empty line
prune_and_reorder_vector

Prune and reorder vector elements
pretty_print_string

Pretty print a string
save_vector_to_file

Save vector to a specified file
save_mat_to_file

Save matrix to a specified file
pretty_print_vector_names

Pretty printing of a vector's names attribute
pretty_print_vector_values

Pretty printing of a vector's values
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
add_row_to_ternary_df

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

Get percentage of matches between two vectors
get_roc_stats

Generate ROC statistics
get_common_names

Get the common names of two vectors
colors.100

100 distinct colors
get_parent_dir

Retrieve the parent directory
dec_to_bin

Convert decimal number to its binary representation
binarize_to_thres

Binarize matrix to given threshold
add_vector_to_df

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

Get ternary class id
get_stats_for_unique_values

Get stats for unique values
make_multiple_density_plot

Multiple densities plot
make_color_bar_plot

Make a color bar plot
ldf_arrange_by_rownames

Rearrange a list of data frames by rownames
normalize_to_range

Range normalization
is_empty

Is object empty?
is_between

Is value between two others?
outersect

Outersect