| aper {heR.Activities} | R Documentation |
Function to plot a bar chart or pie chart of activity pattern data: Percent of time spent in a number of locations or activities.
aper(x, w = NULL, pie = TRUE, plot = TRUE, col = NULL, leg=F,
by.row=TRUE, horiz=FALSE, ylim, xlim, xlab, ylab,
main=deparse(substitute(x)), ...)
x |
vector of data |
w |
vector of weights |
pie |
logical, plot a pie chart or a bar chart |
plot |
logical, plot or not |
col |
vector of colors for the bars or pie wedges |
leg |
logical, plot a legend or not |
by.row |
logical, calculate by row or not; see below |
horiz |
logical, plot horizontal bars or not |
ylim |
y-axis limits |
xlim |
x-axis limits |
xlab |
x-axis label |
ylab |
y-axis label |
main |
plot title |
... |
additional arguments |
Also prints out the weighted mean and number of samples used after NA's are removed.
Takes a data frame x as input and calculates
the percentage that each variate (field)
contributes to the total (presumably 24-hrs
or some other even time interval). The percentage
is calculated as the mean time spent in a certain
activity or location (each field in x) divided by the mean
time spent in all the locations or activities being considered.
Weighted means are used if a vector w containing
weights is supplied; w should have a length
equal to the number of rows in x.
Rows with missing weights are removed; the mean and weighted.mean functions remove missing values
If by.row = TRUE then the percentage for each row (eg. person)
is averaged to get the mean percentage. If by.row = FALSE then
the total time in one variate divided by the overall total time is
used to obtain the 'population' percentage of time spent–same
as a ratio of the mean tie in each variated divided by the mean
of the totaltime spent. If the time
sum for each person is identical, then the two calculation methods give
the same result.
Invoked for side effect of plotting a bar or pie chart
Neil E. Klepeis
http://klepeis.net
http://klepeis.net