Displaying 6 results from an estimated 6 matches for "indf".
Did you mean:
ind
2009 Aug 17
1
how to pass more than one argument to the function called by lapply?
Dear R helpers:
I wonder how to pass more than one argument to the function called by
lapply.
For example,
#R code below ---------------------------
indf <- data.frame(id=I(c('a','b')),y=c(1,10))
#I want to add an addition argument cutoff into the function called by
lapply.
outside.fun <- function(indf, cutoff)
{
unlist(lapply(split(indf, indf[,'id']), function(.x, cutoff) {.x[,'y'] <
cutoff} ))
}
#but the n...
2010 Aug 30
4
different interface to by (tapply)?
...same row), and
having the right names for the columns. ?I don't know how to do this
quickly in the R way. ?(Doing it slowly, e.g., with a for loop over
the list of vectors, is easy, but would not make a nice function for
me to use often.)
for example, lets say my by() output is currently
by( indf, indf$charid, function(x) c(m=mean(x), s=sd(x)) )
$`A`
[1] 2 3
$`B`
[2] 4 5
then the revised by() would instead produce
charid ?m ?s
A ? ? ? ? ?2 ?3
B ? ? ? ? ?4 ?5
working with data frames is often more intuitive than working with the
output of by(). the R wizards are probably chuckling now a...
2009 Aug 25
2
allowing line wrap for long strip text in xyplot (lattice)
Hi. Am brand new to R and to mailing lists - have never posted anywhere
before, so hope I do this right.
Am using R 2.9.1 with lattice graphics (just installed, fully up to date).
Am doing trellis xyplot with y (emp=employment), x (yearmo=a time measure)
and conditioning variable (indf - factor describing industry) -- i.e., (emp
~ yearmo | indf), where all three variables are in a dataframe. The
conditioning variable is a factor with a long text description (e.g.,
"Offices of bank holding companies and of other holding companies
(60551112)" constructed from a much-less-...
2009 Apr 07
0
survival time ties and memory issue with aalen{timereg}.
Dear R-helpers:
I am trying to use aalen{timereg} to run a model and found that it generates
the following message.
the data set I used is
> dim(indf)
[1] 13743 10
#R code:
fit_aalen <- aalen(Surv(durdxdeathp, die) ~ 1+factor(gender), indf)
#start of error message below
Non unique survival times: break ties !
Break ties yourself
Error in aalenBase(times, ldata, X, status, id, clusters, robust = robust,
:
Calloc could not allocate (13840...
2009 Jun 22
1
Problem with storing a sequence of lmer() model fit into a list
...ist<-NULL
for (i in seq_along(depvar_vec))
{
#I found that s_sex, ses1 and race are not useful
fit_i <- lmer(as.formula(gen.ranpoisson.fml.jh(depvar_vec[i],
offsetvar ,factorindepvars, nonfactorindepvars ,ranintvar )),
family=quasipoisson(link="log"),verbose=F, data=indf)
tmp_i<-paste('ranpoi_', depvar_vec[i], sep='')
fit.list[[tmp_i]] <- fit_i
#assign also does not work
#assign(fit.list$parse(text = tmp_i), fit_i)
}
---------------------------------------------------------------
#R gives the following error mess...
2016 Jun 09
4
TableGen operand question
Hi,
As a way to learn LLVM, I'm trying to write a backend for the Microchip
PIC18 8-bit microcontroller.
On this device, the hardware stack is very small and is used only for
storing function return addresses.
A "real" software stack implementation is not very efficient because of the
limited instruction set, so for all the non-reentrant functions I've
decided to use a similar