Displaying 20 results from an estimated 1000 matches similar to: "Indexing in summaryBy"
2007 Oct 30
2
flexible processing
Hello,
unfortunately, I don't know a better subject. I would like to be very flexible
in how to process my data.
Assume the following dataset:
par1 <- seq(0,1,length.out = 100)
par2 <- seq(1,100)
fac1 <- factor(rep(c("group1", "group2"), each = 50))
fac2 <- factor(rep(c("group3", "group4", "group5", "group6"), each =
2000 Dec 29
0
Is this a bug? Having cex!=1 before setting par(mai=) gives strange line spacings.
width <- 7
height <- 5
# create whatever device type
# and have cex=1 before setting par(mai=)
windows(width=width, height=height, rescale="R")
oldmai <- par("mai")
par(cex=1)
par(mai=oldmai)
plot.new()
par(usr=c(0,2,0,2))
par(cex=2)
par1 <- par()
text(1,1,"there is hardly anything i know for sure\nneither of the future nor of the past\nnor should i know what
2006 Feb 08
1
expand.grid without expanding
Dear list,
I've recently came across a problem that I think I've solved and that I wanted
to share with you for two reasons:
- Maybe others come across the same problem.
- Maybe someone has a much simpler solution that wants to share with me ;-)
The problem is as follows: expand.grid() allows you to generate a data.frame
with all combinations of a set of values, e.g.:
>
2007 Dec 19
2
recode based on filter
Hi, I have a data frame DATA, which (simplified of course) looks like this:
know1 = c("Y","N","N","Y","N","N","Y","Y","N")
par1=c(1,4,5,3,3,2,3,3,5)
know2 = c("Y","Y","N","Y","N","N","N","Y","Y")
2008 Aug 26
1
no output when run densityplot...
Hi,
I have downloaded a R script from
http://www.wessa.net/rwasp_edauni.wasp#output.
This script produces a densityplot graphic, amongst others, when is
executed from the web page.
However, when I run it in my machine the *densityplot* function produces
any output, I mean a blank graphic.
But, it's interesting if I run the following lines in the R interactive
console:
> y <-
2009 Dec 29
2
pass functions and arguments to function
Hi,
I wonder how to pass several functions and their arguments as arguments to
a function. For example, the main function is
f = function(X ) {
process1(X)
...
process2(X)
}
I have a few functions that operate on X, e.g. g1(X, par1), g2(X, par2),
g3(X, par3). par1, par2 and par3 are parameters and of different types. I
would like to pass g1, g2, g3 and their arguments to f and g1,
2005 Dec 05
1
how to save output all together
Dear R users:
I have a problem about catch the value from function.
I have following two functions (part):
sbolus1 <- function()
{
.......
for( i in 1:Subject) {
kel<-par1
Vd<-par2
PKindex<-sbolus1.out(PKtime,kel,Vd,defun,par1,par2,Dose,i)
}
savefile(PKindex)
}
sbolus1.out<-function(PKtime,kel,Vd,defun,par1,par2,Dose,i)
{
time<-PKtime$time
2012 May 09
0
Error in outer() : dimension mismatch
Dear R users,
I am a new R user and have some difficulty
understanding the functioning of “outer”, where my question is from. I have
read the posts related to the questions on the outer function, but
unfortunately could not figure out where my mistake is.
I have a function with two variables and
three parameters (a density function that is not standard) and I want to draw
the contourplot along
2011 Apr 07
2
Two functions as parametrs of a function.
Hi R users:
I'm trying to make a function where two of the parameters are
functions, but I don't know how to put each set of parameters for
each function.
What am I missing?
I try this code:
f2<-function(n=2,nsim=100,fun1=rnorm,par1=list(),fun2=rnorm,par2=list()){
force(fun1)
force(fun2)
force(n)
p1<-unlist(par1)
p2<-unlist(par2)
force(p1)
force(p2)
2009 Jun 16
1
Constrained Optimization, a full example
After a few days of work, I think I nearly have it.
Unfortunately, theta is unchanged after I run this (as a script from a
file). I thought that theta would contain the fitted parameters.
The goal here is to find the least squares fit according to the function
defined as "rss" subject to the constraints defined as ui and ci.
I defined ui and ci to (hopefully) force par2 and par3
2004 Dec 14
1
Multiple options for a package
Hi R-devel,
I am facing a situation where the number of options I would like to propose
to the user is somewhat big (and could easily increase more and more as I
will code up a little more - even coming to a point where an user should be
able to implement his own options).
What we have to handle options is the couple:
options(par=value) and getOption("par")
I was aking myselft what
2001 Jan 15
1
Re: AW: par(par()) corrupts devices (PR#807)
> From: "Dr. Jens Oehlschlägel" <jens.oehlschlaegel@bbdo-interone.de>
> Date: Mon, 15 Jan 2001 13:58:00 +0100
>
> Dear Prof. Ripley,
>
> I do not insist that features are bugs, so I stop sending this to r-bugs
> and cc r-devel instead
>
> > I am replying to this from the archive: I did not actually receive a
> copy.
>
> But it is right
2009 Dec 29
1
(no subject)
Hi,
I wonder how to pass several functions and their arguments as arguments to
a function. For example, the main function is
f = function(X ) {
process(X)
...
process(X)
}
I have a few functions that operate on X, e.g. g1(X, par1), g2(X, par2),
g3(X, par3). par1, par2 and par3 are parameters and of different types.
2010 Mar 17
2
Using nrow with summaryBy
Hello Everyone-
I'm calculating summary statistics on a dataset (~4000 records,
observations are not uniformly distributed) using summaryBy and trying
to add a column with the number of observations to the output as well.
What occurs to me is to use nrow(), but this doesn't appear to be working
I'm able to replicate the same results with an example from the
summaryBy docs:
2009 May 20
1
SEM:Standard error of std.coef estimates?
Hi,
I am currently working with the sem package in R, to create pathway
diagrams. Id like to use the standardized path coeffcients. To get these, I
use std.coef. However, using this yields only the standardized coefficients,
but does not give me the standard error. Does someone know how to get
std.coef to show the standard error of the standardized path coefficients as
well?
Thanks,
Bastiaan
2011 Jan 17
2
Using summaryBy with weighted data
Dear Soren and R users:
I am trying to use the summaryBy function with weights. Is this possible? An example that illustrates what I am trying to do follows:
library(doBy)
## make up some data
response = rnorm(100)
group = c(rep(1,20), rep(2,20), rep(3,20), rep(4,20), rep(5,20))
weights = runif(100, 0, 1)
mydata = data.frame(response,group,weights)
## run summaryBy without weights:
2011 Feb 04
2
vegan and sweave using xtable
Dear all,
Using:
library(vegan)
data(BCI)
mod <- radfit(BCI[1,])
mod
RAD models, family poisson
No. of species 93, total abundance 448
par1 par2 par3 Deviance AIC BIC
Null 39.5261 315.4362 315.4362
Preemption 0.042797 21.8939 299.8041 302.3367
Lognormal 1.0687 1.0186 25.1528 305.0629 310.1281
2012 Apr 02
2
summaryBy: transformed variable on RHS of formula?
Hi Folks,
I'm trying to cut my data inside the summaryBy function. Perhaps
formulas don't work that way? I'd like to avoid adding another column
if possible, but if I have to, I have to. Any ideas?
Thanks,
Allie
require(doBy)
df = dataframe(a <- rnorm(100), b <-rnorm(100))
summaryBy(a ~ cut(b,c(-100,-1,1,100)), data=df) # preferred
solution, but it throws an
2005 Nov 22
1
problem with "parse"
Hi there again,
I have a problem with the "parse"-command.
First of all, I show you in a simplified way, what I am trying to do and what "R" answers:
> test
[1] "u.g$par1, u.g$par2"
> mode(test)
[1] "character"
> ausdruck <- parse(text = test)
Error in parse(file, n, text, prompt) : syntax error in "u.g$par1,"
2006 Dec 05
1
summaryBy(): Is it the best option?
Hi,
since I have quite large tables and the processing
takes quite a while I am
curious if I can improve the performance of this
aggregation somehow: At the
moment I am using summaryBy from the doBy package
under R 2.4.0, Win2K.
summaryBy(soc_s6aq5 + soc_s6aq7 + soc_s6aq9 +
soc_s6aq11 ~ hh +
comgroup,soc6a,postfix=c("","","",""),FUN=sum,
na.rm=T)
The