Learn R Programming

guf

R package: Generally Useful Functions

This package can be thought of as an extension of 'base R', in the sense that it provides simple, "base R"-like functionality. In short (and see details in documentation/help):

%notin% which is the inverse of and complements %in%

right() which gives a specifiable number of characters from the 'right' side of a character string

left() which gives a specifiable number of characters from the 'left' side of a character string

se() which gives the standard error of a numerical vector

round_something() which provides a numerical rounding of a vector, matrix or dataframe to a specifiable decimal place; the dataframe can be of mixed variable types, as only numerical columns are rounded

count() which counts the number of elements per unique element in a vector, matrix or combination of vectors (dataframe columns); this function can 'pivot', i.e., make vertical rows horizontal

aggro() which can make aggregates, somewhat like the already existing aggregate(), but then also with the option of 'pivoting'

Copy Link

Version

Install

install.packages('guf')

Monthly Downloads

9

Version

1.0.2

License

GPL-3

Maintainer

Ben Johannes

Last Published

February 20th, 2020

Functions in guf (1.0.2)

left

Get the specified left most characters of a string
%notin%

The inverse of %in%
round_something

The function round_something() does numerical rounding with a specified number of decimals. The 'something' will typically be a data.frame with mixed column types, of which the numerical columns must be rounded. This function makes that easier: all non-numerical columns are left in place, the numerical columns are rounded. Columns that are character but can be interpreted as numerical are first converted to numerical, and then rounded.
aggro

Aggregates a numerical column
count

Count the number of occurences of every unique element in a data object
se

Standard Error
right

Get the specified right most characters of a string