search for: agg2

Displaying 7 results from an estimated 7 matches for "agg2".

Did you mean: agg
2011 Jan 26
1
aggregate(as.formula("some formula"), data, function) error when called from in a function
...m with aggregate.formula when I call it in a function and the function is converted from a string in the funtion I think my problem may also only occur when the left hand side of the formula is cbind(...) Here is example code that generates a dataset and then the error. The first function "agg2" fails > agg2(FALSE) do agg 2 Error in m[[2L]][[2L]] : object of type 'symbol' is not subsettable but, if I run it have it return what it is going to pass to aggregate and pass it myself, it works. I can use this for a workaround (agg3) where one function does this itself. I'...
2008 Mar 29
3
Generating maps in R
Greetings! I am trying plot some data on a map in R. Here's the scenario. I have a variable called probworkinghealthy which contains a predicted probability of employment for every individual in my sample (about 100,000 observations). I have another variable, called a001ter, which contains the subject of residency in the Russian Federation (akin to a US state) for every individual in the
2007 Dec 16
2
question about the aggregate function with respect to order of levels of grouping elements
...actor(months(df[,1])) levels(fmonth) # factor() automatically generates the correct order of levels. [1] "Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul" "Aug" "Sep" "Oct" "Nov" "Dec" agg2=aggregate(df[,2],list(year=years(df[,1]),month=fmonth),sum) levels(agg2$month) # even if a factor with levels in the correct order is supplied, aggregate(), sortsthe levels by alphabet regardless. [1] "Apr" "Aug" "Dec" "Feb" "Jan" "Jul" &...
2012 May 08
2
How to deal with a dataframe within a dataframe?
Hello all, I am doing an aggregation where the aggregating function returns not a single numeric value but a vector of two elements using return(c(val1, val2)). I don't know how to access the individual columns of that vector in the resulting dataframe though. How is this done correctly? Thanks, robert > agg <- aggregate(formula=df$value ~ df$quarter + df$tool, + FUN=cp.cpk,
2012 Jun 05
4
need descriptive help
Hi all, I'm new to using R, and apologize for simplicity of this question. I'm using a data set with over 60,000 observations, Two variables are patient ID, and cost incurred by the patient. I'd like to generate frequency/table by patient and cost IF the total cost is over 2000. Right now I'm using: by(x$cost, x$patient, sum) but this generates a huge list for each patient.
2012 Sep 07
7
Producing a table with mean values
Hi All, I have a data set wit three size classes (pico, nano and micro) and 12 different sites (Seamounts). I want to produce a table with the mean and standard deviation values for each site. Seamount Pico Nano Micro Total_Ch 1 Off_Mount 1 0.0691 0.24200 0.00100 0.31210 2 Off_Mount 1 0.0938 0.00521 0.02060 0.11961 3 Off_Mount 1 0.1130 0.20000 0.06620 0.37920 4 Off_Mount 1
2011 Jan 11
0
modified FAST Script from package SensoMineR for the R community - Reg
...e[, 2] = rep(colnames(don), each = I) for (i in 1:J) { texte[((I * (i - 1)) + 1):(I * i), 3] = paste(don[, i]) } nbp = strsplit(summary(don, maxsum = max(lev)), ":") agg = rep(0, J * max(lev)) for (i in 1:(J * max(lev))) { agg[i] = nbp[[i]][2] } agg2 = na.omit(agg) agg2 = as.factor(agg2) if (graph) { ##x11() plot(agg2, main = "Number of products per group") } acm_call = list(X = acm$call$X, marge.col = acm$call$marge.col, marge.row = acm$call$marge.row, ncp = acm$call$ncp, quali = acm$call$qua...