Displaying 12 results from an estimated 12 matches for "xapply".
Did you mean:
apply
2008 Nov 12
2
Outer, kronecker, etc.
...[,2]
[1,] List,2 List,2
[2,] List,2 List,2
By the way: how can I get this not to abbeviate the entries but
instead give me something like:
[,1] [,2]
[1,] list(1, 3) list(2, 3)
[2,] list(1, 4) list(2, 4)
The closest I can get is matrix(as.character(mm),2,2)
By-the-way^2: is there some Xapply function that maps a function over
all the elements of a structure (vector, matrix, list, ...) and
preserves the original structure? For example, I'd want
Xapply(matrix(1:4^2,2,2),sqrt) == sqrt(matrix(1:4^2,2,2)). In this
case, I'd use Xapply(as.character,mm), because as.character returns...
2010 Nov 12
1
Xapply question
Dear list,
I'm stuck with looking for a function of the *apply family, which I suppose
exists already ? just I can't find it:
What I'm looking for is somewhere between sweep and mapply that does a
calculation vectorized over a matrix and a vector:
It should work complementary to sweep: for each row of the matrix, a different
value of the vector should be handed over.
Close to
2023 Aug 10
2
Expresión en un objeto
..., NA, 5)
V2b <- c (37, NA, 15, NA, NA, NA, 90, NA, 161, NA)
Supongamos que tengo la expresión (que no puedo asignarlo a ninguna variable):
(ifelse (is.na (V2a) & ! is.na (V2b), V2b, V2a))
Supongamos que tengo que utilizar esta expresión dos o más veces y no
puedo utilizar ni un xapply () ni un bucle. Por ejemplo:
V3 <- (((ifelse (is.na (V2a) & ! is.na (V2b), V2b, V2a)) - V1)/V1)*100
V4 <- ifelse (! is.na ((((ifelse (is.na (V2a) & ! is.na (V2b),
V2b, V2a))-V1)/V1)*100), ifelse ((((ifelse (is.na (V2a) & ! is.na
(V2b), V2b, V2a))-V1)/V1)*100 > 0, "1&qu...
2023 Aug 11
1
Expresión en un objeto
..., NA, 5)
V2b <- c (37, NA, 15, NA, NA, NA, 90, NA, 161, NA)
Supongamos que tengo la expresión (que no puedo asignarlo a ninguna variable):
(ifelse (is.na (V2a) & ! is.na (V2b), V2b, V2a))
Supongamos que tengo que utilizar esta expresión dos o más veces y no puedo utilizar ni un xapply () ni un bucle. Por ejemplo:
V3 <- (((ifelse (is.na (V2a) & ! is.na (V2b), V2b, V2a)) - V1)/V1)*100
V4 <- ifelse (! is.na ((((ifelse (is.na (V2a) & ! is.na (V2b),
V2b, V2a))-V1)/V1)*100), ifelse ((((ifelse (is.na (V2a) & ! is.na (V2b), V2b, V2a))-V1)/V1)*100 > 0, "1&qu...
2023 Aug 11
1
Expresión en un objeto
...NA, NA, NA, 90, NA, 161, NA)
>
> Supongamos que tengo la expresión (que no puedo asignarlo a ninguna
> variable):
>
> (ifelse (is.na (V2a) & ! is.na (V2b), V2b, V2a))
>
> Supongamos que tengo que utilizar esta expresión dos o más veces y no
> puedo utilizar ni un xapply () ni un bucle. Por ejemplo:
>
> V3 <- (((ifelse (is.na (V2a) & ! is.na (V2b), V2b, V2a)) - V1)/V1)*100
> V4 <- ifelse (! is.na ((((ifelse (is.na (V2a) & ! is.na (V2b),
> V2b, V2a))-V1)/V1)*100), ifelse ((((ifelse (is.na (V2a) & ! is.na
> (V2b), V2b, V2a))-V1)/...
2023 Aug 11
1
Expresión en un objeto
...>
> > Supongamos que tengo la expresión (que no puedo asignarlo a ninguna
> > variable):
> >
> > (ifelse (is.na (V2a) & ! is.na (V2b), V2b, V2a))
> >
> > Supongamos que tengo que utilizar esta expresión dos o más veces y no
> > puedo utilizar ni un xapply () ni un bucle. Por ejemplo:
> >
> > V3 <- (((ifelse (is.na (V2a) & ! is.na (V2b), V2b, V2a)) - V1)/V1)*100
> > V4 <- ifelse (! is.na ((((ifelse (is.na (V2a) & ! is.na (V2b),
> > V2b, V2a))-V1)/V1)*100), ifelse ((((ifelse (is.na (V2a) & ! is.na
> >...
2023 Aug 12
1
Expresión en un objeto
...tengo la expresión (que no puedo asignarlo a ninguna
> > > variable):
> > >
> > > (ifelse (is.na (V2a) & ! is.na (V2b), V2b, V2a))
> > >
> > > Supongamos que tengo que utilizar esta expresión dos o más veces y no
> > > puedo utilizar ni un xapply () ni un bucle. Por ejemplo:
> > >
> > > V3 <- (((ifelse (is.na (V2a) & ! is.na (V2b), V2b, V2a)) -
> V1)/V1)*100
> > > V4 <- ifelse (! is.na ((((ifelse (is.na (V2a) & ! is.na (V2b),
> > > V2b, V2a))-V1)/V1)*100), ifelse ((((ifelse (is.na (V2...
2010 Apr 12
1
how to calculate a table
Hi R-Group,
I am stuck with the following problem: I am constructing a portfolio of
2 variables x and y
x <- rnorm(100, mean=100, sd=4)
y <- rnorm(100, mean=120, sd=10)
which I am combining as follows to a portfolio for sampling purposes:
portfolio <- c(rep(x, 8), rep(y, 2))
In this case I have assigned the weights of 8 and 2 to calculate the
bootstrapped mean:
mean.boot <-
2011 Jan 02
3
The Percentile of a User-Defined pdf
I would like to give a probability distribution function of a function of
(x,y) on the half-plane y>0, and a constant 0<c<1 and I would like to know
the c percentile of the marginal distribution of x. I have tried along
the lines of the following but I keep getting errors:
# SIMPLIFIED PROBLEM
# The plan is to solve for the .975 percentile "xc" of the marginal x
distribution
2011 Mar 30
4
a for loop to lapply
Dear all,
I am trying to learn lapply.
I would like, as a test case, to try the lapply alternative for the
Shadowlist<-array(data=NA,dim=c(dimx,dimy,dimmaps))
for (i in c(1:dimx)){
Shadowlist[,,i]<-i
}
---so I wrote the following---
returni <-function(i,ShadowMatrix) {ShadowMatrix<-i}
lapply(seq(1:dimx),Shadowlist[,,seq(1:dimx)],returni)
So far I do not get same results
2005 Oct 31
1
[R] unvectorized option for outer()
> From: Thomas Lumley
>
> On Sun, 30 Oct 2005, Jonathan Rougier wrote:
>
> > I'm not sure about this. Perhaps I am a dinosaur, but my feeling is
> > that if people are writing functions in R that might be subject to
> > simple operations like outer products, then they ought to be writing
> > vectorised functions!
>
> I would agree. How about an
2010 Feb 25
24
two questions for R beginners
* What were your biggest misconceptions or
stumbling blocks to getting up and running
with R?
* What documents helped you the most in this
initial phase?
I especially want to hear from people who are
lazy and impatient.
Feel free to write to me off-list. Definitely
write off-list if you are just confirming what
has been said on-list.
--
Patrick Burns
pburns at pburns.seanet.com