Displaying 11 results from an estimated 11 matches for "l_ply".
2009 Sep 28
4
How to assess object names within a function in lapply or l_ply?
Dear All,
to produce output of several columns of a data frame, I tried to use
lapply and also l_ply. In both cases, I would like to print a header
line containing also the name of the respective column in the data frame.
For example, I would like the following
lapply(data.frame(a=1:3, b=2:4), function(x) print(deparse(substitute(x))))
to produce:
[1] "a"
[1] "b"
and not,...
2010 Jul 07
1
problems with write.table, involving loops & paste statement
...al order that
I would like.
How can I fix this?
Thank you!
*************************
Code:
A_var_df <- data.frame(index=1:length(seq(1.0, -0.9, by= -0.1)),
from=seq(1.0, -0.9, by= -0.1), to=seq(0.9, -1.0, by= -0.1))
for(i in 1:length(A_var_df[,1]))
{
library(plyr)
max.col <- ncol(Dchr1)
l_ply(seq(1, max.col, by=3573), function(k)
write.table(as.data.frame(Dchr1[,k:min(k+3572, max.col)]), paste("./A_",
A_var_df[i,1], "/k.csv", sep=""), sep=",", row.names=F, quote=F) )
}
**************************
--
Thanks,
CC
[[alternative HTML version delete...
2011 Jun 30
2
Saving fExtremes estimates and k-block return level with confidence intervals.
I am estimating a large model by groups. How do you save the results and?returns
the associated quantiles?
For this example I need a data frame
n?? ?xi??????? mu????????beta
1?? 0.1033614? 2.5389580 0.9092611
2? ?0.3401922? 0.5192882 1.5290615
3?? 0.5130798? 0.5668308 1.2105666
I also want to apply gevrlevelPlot() for each "n" or group.
?
#Example
n <- c(1, 1, 1, 1, 1, 1, 2, 2, 2,
2009 Apr 29
2
help converting for loop to vector operation
Dear List,
I have a wrapper function that draws a graph that I'd like to use in a vector-like manner. The for-loop version I currently use is below.
library(ggplot2)
data(economics)
h <- 600
w <- 800
#----------------------------------------------------------
draw_metric_by_date <- function( df, i, smooth=FALSE, BASEPATH ) {
mlabel <- names(df)[i]
qmetric
2008 Sep 30
0
New package: plyr
...rding to the type of object they input
(first letter) and output (second letter):
* llply = from a list to a list
* alply = from an array (or vector, or matrix) to a list
* ldply = from a list to a data.frame
* d_ply = from a data.frame, ignore output
* and so on for llply, laply, ldply, l_ply, alply, aaply, adply,
a_ply, dlply, daply, dply, d_ply
plyr also provides:
* m*ply which works in a similar way to mapply
* r*ply which works in a similar way to replicate
You can find out more at http://had.co.nz/plyr/, including a 20 page
introductory guide, http://had.co.nz/plyr/plyr-intr...
2008 Sep 30
0
New package: plyr
...rding to the type of object they input
(first letter) and output (second letter):
* llply = from a list to a list
* alply = from an array (or vector, or matrix) to a list
* ldply = from a list to a data.frame
* d_ply = from a data.frame, ignore output
* and so on for llply, laply, ldply, l_ply, alply, aaply, adply,
a_ply, dlply, daply, dply, d_ply
plyr also provides:
* m*ply which works in a similar way to mapply
* r*ply which works in a similar way to replicate
You can find out more at http://had.co.nz/plyr/, including a 20 page
introductory guide, http://had.co.nz/plyr/plyr-intr...
2009 Nov 19
4
Is there an variant of apply() that does not return anything?
There are a few version of apply() (e.g., lapply(), sapply()). I'm
wondering if there is one that does not return anything but just
silently apply a function to the list argument.
For example, the plot function is applied to each element in 'alist'.
It is redundant to return anything from apply.
apply(alist,function(x){ plot each element of alist})
2010 May 31
4
Fancy Page layout
Hi,
Working on a report that is going to have a large number of graphs and
summaries. We have 80 "groups" with 20 variables each.
Ideally, I'd like to produce ONE page for each group. It would have two
columns of 10 graphs and then the 5 number summary of the variables at
the bottom.
So, perhaps the top 2/3 of the page has the graphs and the bottom third
has 20 rows of data
2009 Sep 28
4
Running an ANOVA with a BY
I have a simple 1 way anova coded like
summary(ANOVA1way <- aov(Value ~ WellID, data = welldata))
How can I use the BY function to do this ANOVA for each group using another
variable in the dataset?? I tried coding it like this, but it doesn't seem
to work.
summary(ANOVA1way <- by(welldata, Analyte, function(x) aov(Value ~ WellID,
data = welldata)))
In SAS I would code it like this:
2010 Jun 01
4
Plot multiple columns
I'm running a long MCMC chain that is generating samples for 22 variables.
I have each run of the chain as a row in a matrix.
So: Chain[,1] is the column with all the samples for variable one.
Chain[,2] is the column with all the samples for variable 2, etc.
I'd like to fit all 22 on a single page to print a nice summary. It is
OK if the graphs are small, I just need to show the
2010 Dec 29
5
linear regression for grouped data
Hi,
I have been examining large data and need to do simple linear regression
with the data which is grouped based on the values of a particular
attribute. For instance, consider three columns : ID, x, y, and I need to
regress x on y for each distinct value of ID. Specifically, for the set of
data corresponding to each of the 4 values of ID (76,111,121,168) in the
below data, I should invoke