similar to: dynamic list in aggregate()

Displaying 20 results from an estimated 10000 matches similar to: "dynamic list in aggregate()"

2009 Mar 02
1
how to pass a command variable in DOS to R program in R CMD BATCH
Hi all, I need to run a program (asreml) thousands of times and each time I have to provide a slightly different dataset. Because I have to run asreml under Windows (DOS or scripts) environment, I have trouble to pass a command variable (or pointer variable or %counter in the following example) to R program so at each counter R can generate a different data set for asreml to run. Any
2008 Sep 09
2
match problem by rownames
Hi all, While dat['a1',] and dat['a10',] produce the same results in the following example, I'd like dat['a1',] to return NAs. dat <- data.frame(x1 = paste(letters[1:5],10, sep=''), x2=rnorm(5)) rownames(dat) <- dat$x1 dat['a1',] dat['a10',] > sessionInfo() R version 2.7.2 (2008-08-25) i386-pc-mingw32 locale:
2010 Oct 22
1
Problem with Aggregate - Sum, limit on number of criteria
Hello, It appears there is a limit in the number of criteria that can be put into the Aggregate sum function. (It looks like it is 32). My code is; HSfirst=aggregate(count,
2007 Sep 08
1
Problem with the aggregate command
Dear friends, I have a data set with 23 columns and 38000 rows. It is a panel running from the years 1991 through 2005. I want to aggregate the data and get the medians of each of the 23 columns for each of the years. In other words my output should be like this Year Median 1991 123 1992 145 1993 132 etc. The sample lines of code to do this operation is set1 <-
2010 Mar 07
3
aggregate for zoo or its?
Dear R People: The aggregate function works very well on regular time series. Is there a version for zoo or its that would take daily data and convert it to monthly, please? Thanks in advance, Sincerely, Erin -- Erin Hodgess Associate Professor Department of Computer and Mathematical Sciences University of Houston - Downtown mailto: erinm.hodgess at gmail.com
2012 Jan 17
2
Using Aggregate() with FUN arguments, which require more than one input variables
Dear all, I am trying to apply the aggregate() function to calculate correlations for subsets of a dataframe. My argument x is supposed to consist of 2 numerical vectors, which represent x and y for the cor() function. The following error results when calling the aggregate function: Error in FUN(X[[1L]], ...) : supply both 'x' and 'y' or a matrix-like 'x'. I think the
2010 Oct 06
3
what is the "NOT IN" operator
Good day, I need to subset a data by removing several rows. I know the %in% operator, i.e. sub <- mydata[group %in% c("A","B","E","G"), ] What I need is the opposite, that is remove rows and/or columns. What is the operator for "NOT IN"? I tried (i)! %in% and (ii) ^%in% and both resulted in a "could not find function" error.
2009 Jun 08
3
Plotting two regression lines on one graph
Hi! I have fitted two glms assuming a poisson distribution which are: fit1 <- glm(Aids ~ Year, data=aids, family=poisson()) fit2 <- glm(Aids ~ Year+I(Year^2), data=aids, family=poisson()) I am trying to work out how to represent the fitted regression curves of fit1 and fit2 on the one graph. I have tried: graphics.off() plot(Aids ~ Year, data = aids) line(glm(Aids ~ Year,
2008 Jul 09
3
randomly select duplicated entries
Using this data as an example dat <- read.table(textConnection("Id myvar 12 1 12 2 12 6 34 9 34 4 34 8 65 15 65 23"), header = TRUE) closeAllConnections() how can I create another data set that does not have duplicate entries for 'Id', but the included values are randomly selected from the available ones. Thanks! Juliet
2009 Dec 02
2
lattice: adding information on number of observations
Dear R-users, I am using R version 2.9.1 and lattice 0.17-26 under windows. In a lattice boxplot, I would like to add information on how many observations each singel boxplot is based upon. For example (the basic plot): # Begin R-code library(lattice) dat <- data.frame(panvar = rep(c("A","B","A","B"), c(3,7,4,6)), grp = rep(c("grp1",
2010 Oct 08
2
Count values in a dataframe with respect to groups
Dear all, I am looking for a function to count values belonging to a class within a dataframe (and ignore NAs). grp = c(1,1,1, 1,2, 2,2) val = c(2,1,5,NA,3,NA,1) dta = data.frame(grp=grp, val=val) The result should look like: grp count 1 3 2 2 At the moment, I am trying to find a function for FUN in aggregate, but with no success. Can anybody help me? Thanks in advance. Marcus
2009 Jun 10
1
how to get output from a nested loop
Dear all, I imagine that this is a trival question, but it has perplexed for most of the day. Any help would be greatly appreciated. Below is an example of what I'm trying to do. Essentially I want to produce all unique 1 x 1 combinations of certain columns from a dataframe, and join these to other columns from the same dataframe. I'm having problems with the nested loop as I can only
2005 Nov 03
1
Specify Z matrix with lmer function
Is there a way to specify a Z matrix using the lmer function, where the model is written as y = X*Beta + Z*u + e? I am trying to reproduce smoothing methods illustrated in the paper "Smoothing with Mixed Model Software" my Long Ngo and M.P. Wand. published in the /Journal of Statistical Software/ in 2004 using the lme4 and Matrix packages. The code and data sets used can be found at
2010 Feb 14
2
xyplot, overlay two variables on one plot with group factors
All I want to overlay two variables on the same plot following their appropriate grouping. I have attempted to use subscripting in panel with panel.xyplot, but I can't get the grouping to follow into the panel...here is an example... dat<-data.frame( y= log(1:10), y2=10:19, x=1:10, grp = as.factor(1) ) dat2<-data.frame( y= log(10:19), y2= 20:29, x=1:10, grp = as.factor(c(2)) )
2006 Sep 23
4
plotting grouped data object
All, I'd like to plot the main relationship of a grouped data object for all levels of a factor in a single panel. The sample code below creates a separate panel for each level of the factor. I realize that this could be done in other ways, but I'd like to do it via plotting the grouped data object. thanks! dave z = rnorm(18, mean=0, sd=1) x = rep(1:6, 3) y =
2005 Jun 26
4
Mixed model
Hi All, I am currently conducting a mixed model. I have 7 repeated measures on a simulated clinical trial. If I understand the model correctly, the outcome is the measure (as a factor) the predictors are clinical group and trial (1-7). The fixed factors are the measure and group. The random factors are the intercept and id and group. I tried using 2 functions to calculate mixed effects.
2007 Oct 11
1
creating summary functions for data frame
I have a data frame that looks like this: > gctablechromonly[1:5,] refseq geometry gccontent X60_origin X60_terminus length kingdom 1 NC_009484 cir 0.6799 1790000 773000 3389227 Bacteria 2 NC_009484 cir 0.6799 1790000 773000 3389227 Bacteria 3 NC_009484 cir 0.6799 1790000 773000 3389227 Bacteria 4 NC_009484 cir 0.6799
2012 Mar 02
1
indicating group numbers in a dendrogram
Hi, Is it possible to place the group number in a cluster? The best example I found was at https://www.crops.org/images/publications/cs/42/5/1584f4.jpeg (see I, II, IIIa, IIIb) It would help to identify the group given by cutree since branches can turn around and they necessarily are not plotted in order (group 2 is not necessarily the second from the left). Thanks for any help. All the
2010 Mar 04
4
Analogue to SPSS regression commands ENTER and REMOVE in R?
I am not sure if this question has been asked before - but is there a procedure in R (in lm or glm?) that is equivalent to ENTER and REMOVE regression commands in SPSS? Thanks a lot! -- Dimitri Liakhovitski Ninah.com Dimitri.Liakhovitski at ninah.com
2010 Jan 26
2
tapply and more than one function, with different arguments
Dear R-users, I am working with R version 2.10.1. Say I have is a simple function like this: > my.fun <- function(x, mult) mult*sum(x) Now, I want to apply this function along with some other (say 'max') to a simple data.frame, like: > dat <- data.frame(x = 1:4, grp = c("a","a","b","b")) Ideally, the result would look something like