Learn R Programming

MAINT.Data (version 2.7.1)

AgrMcDt: Agregate Micro Data

Description

AgrMcDt creates IData objects by agregating a Data Frame of Micro Data.

Usage

AgrMcDt(MicDtDF, agrby, agrcrt="minmax")

Value

An object of class IData with the data set of Interval-valued variables resulting from the aggregation performed.

Arguments

MicDtDF

A data frame with the original values of the micro data.

agrby

A factor with categories on which the micro data should be aggregated.

agrcrt

The aggregation criterion. Either the ‘minmax’ string, or a two dimensional vector with the prob. value for the left (lower) percentile, followed by the prob. value for the right (upper) percentile, used in the aggregation.

See Also

IData

Examples

Run this code

# Create an Interval-Data object by agregating the microdata consisting 
# of 336776 NYC flights included in the FlightsDF data frame, 
# by the statistical units specified in the FlightsUnits factor.

Flightsminmax <- AgrMcDt(FlightsDF,FlightsUnits)

#Display the first and last observations

head(Flightsminmax)
tail(Flightsminmax)

#Print summary statistics

summary(Flightsminmax)

if (FALSE) {

# Repeat this procedure using now the 10th and 90th percentiles.

Flights1090prcnt <- AgrMcDt(FlightsDF,FlightsUnits,agrcrt=c(0.1,0.9))

#Display the first and last observations

head(Flights1090prcnt)
tail(Flights1090prcnt)

summary(Flights1090prcnt)

}

Run the code above in your browser using DataLab