Learn R Programming

fctutils (version 0.0.7)

Advanced Factor Manipulation Utilities

Description

Provides a collection of utility functions for manipulating and analyzing factor vectors in R. It offers tools for filtering, splitting, combining, and reordering factor levels based on various criteria. The package is designed to simplify common tasks in categorical data analysis, making it easier to work with factors in a flexible and efficient manner.

Copy Link

Version

Install

install.packages('fctutils')

Monthly Downloads

197

Version

0.0.7

License

GPL-3

Maintainer

Kai Guo

Last Published

September 30th, 2024

Functions in fctutils (0.0.7)

ft_collapse_lev

Collapse Factor Levels Based on Grouping
ft_dummy

Create Dummy Variables from Factor Levels
ft_apply

Apply a Function to Factor Levels
ft_char_freq

Reorder Factor Levels Based on Character Frequency at Positions
ft_duplicates

Flag Duplicate Factor Levels
ft_group_by_prefix

Group Factor Levels by Common Prefix
ft_count

Reorder Factor Levels by Level Count
ft_combine

Combine Two Vectors of Unequal Lengths and Sort Based on Specified Levels
ft_na

Handle NA Values in Factor Vectors
ft_pad_levels

Pad Factor Levels with Leading Characters
ft_extract

Extract Substrings from Factor Levels
ft_filter_freq

Filter Factor Levels by Frequency and Recalculate Character Frequencies
ft_filter_func

Filter Factor Levels Using a Function
ft_filter_pos

Remove Factor Levels with Specific Characters at Specified Positions
ft_impute

Impute Missing Values in Factor Vector
ft_encode

Encode Factor Levels into Numeric Codes
ft_pairs

Generate Pairwise Comparisons Between Elements in factor
ft_pattern_replace

Replace Patterns in Factor Levels (Deprecated)
ft_freq

Reorder Factor Levels Based on Character Frequency
ft_level_order

Get Order of Factor Levels in Data
ft_len

Sort Factor Levels Based on Their Length
ft_factorize

Factorize Character Vectors with Consistent Levels
ft_level_stats

Calculate Statistics for Each Factor Level
ft_map_func

Map Factor Levels Using a Function
ft_merge

Merge Two Factors and Retain Unique Levels
ft_sort_custom

Sort Factor Levels Using a Custom Function
ft_level_lengths

Get Character Lengths of Factor Levels
ft_split

Split Factor Levels and Reorder Based on Specified Criteria
ft_mapping

Create a Mapping Table of Original and Modified Factor Levels
ft_remove_levels

Remove Specified Levels from a Factor
ft_union

Get Union of Factor Levels from Multiple Vectors
ft_merge_similar

Merge Similar Factor Levels
ft_insert

Insert New Levels into a Factor Vector After Specified Targets
ft_pos

Reorder Factor Levels Based on Characters at Specified Positions
ft_sample_levels

Sample Levels from a Factor Vector
ft_replace_na

Replace NA Values in Factor Vector
ft_replace_pattern

Replace Parts of Factor Levels Based on a Pattern
ft_rename_levels

Rename Factor Levels Using Data Frame Mapping
ft_intersect

Get Intersection of Factor Levels from Multiple Vectors
ft_reorder_within

Reorder Factor Levels Within Groups
ft_sort

Sort Factor Levels Based on Another Vector or Column
ft_regex_freq

Reorder Factor Levels Based on Regex Pattern Frequency
ft_substr_freq

Reorder Factor Levels Based on Substring Frequency
ft_split_levels

Split Factor Levels into Multiple Factors
ft_unique_comb

Create Factor of Unique Combinations from Multiple Factors
ft_sub

Reorder Factor Levels Based on Substrings
ft_table

Count Character Frequencies in Factor Levels (Including NA Handling)
ft_replace

Replace a Factor Level and Optionally Insert at Specified Position
ft_reverse

Reverse Factor Levels
ft_rollup

Aggregate Factor Levels Based on Grouping
ft_concat

Concatenate Multiple Factor Vectors
ft_decode

Decode Numeric Codes into Factor Levels