Displaying 1 result from an estimated 1 matches for "catsbyday2".
2024 Dec 11
2
aggregate produces results in unexpected format
...me, inJan2Test, by levels of the dataframe variable MyDay. The output should be in the form of a dataframe.
#my code:
# This function should process a data frame and return a data frame
# containing the mean, minimum, maximum, and number of observations
# in the data frame for each level of MyDay.
catsbyday2 <- function(df){
# Create a matrix to hold the calculated values.
xx <- matrix(nrow=1,ncol=4)
# Give names to the columns.
colnames(xx) <- c("Mean","min","max","Nobs")
cat("This is the matrix that will hold the results\n",xx,"...