squish: Returns a single-length vector if all values in vector are...

View source: R/squish.R

squishR Documentation

Returns a single-length vector if all values in vector are identical.

Description

This can be used with group_by() to transform data to a "higher" level with hierarchically structured data. For instance, one person may have multiple web visits, where all visits would have the same age and gender. Getting to the person-level data (each observation is a person) would require 'summarising'. squish() throws up an error message if values differ.

Usage

squish(x)

Arguments

x

A vector to be passed through, can be numeric or character.

Examples

## Not run: 
squish(c(1,2,1))

## End(Not run) 
squish(c(1,1,1))


martinctc/surveytools documentation built on Nov. 21, 2024, 10:48 p.m.