Displaying 20 results from an estimated 2000 matches similar to: "problem with aperm? (PR#568)"
2010 Dec 27
1
aperm() should retain class of input object
aperm() was designed for multidimensional arrays, but is also useful for
table objects, particularly
with the lattice, vcd and vcdExtra packages. But aperm() was designed
and implemented before other
related object classes were conceived, and I propose a small tune-up to
make it more generally useful.
The problem is that aperm() always returns an object of class 'array',
which
2010 Jul 29
1
Using 'dimname names' in aperm() and apply()
I think that the "dimname names" of tables and arrays could make
aperm() and apply() (and probably some other functions) easier to use.
(dimname names are, for example, created by table() )
The use would be something like:
--
x <-table( from=sample(3,100,rep=T), to=sample(5,100,rep=T))
trans <- x / apply(x,"from",sum)
y <- aperm( trans,
2004 Mar 10
3
aperm() and as.list() args to "["
Hi everyone.
I'm playing with aperm():
a <- 1:24
dim(a) <- c(2,3,2,2)
permutation <- c(1,2,4,3)
b <- aperm(a,permutation)
So if my understanding is right,
a[1,3,2,1] == b[c(1,3,2,1)[permutation] ]
but this isn't what I want because the RHS evaluates to a vector, and
I am trying to identify a single element of b.
How do I modify the RHS to give what I want?
Following
2001 Jul 10
0
speeding up aperm/ adding repmat
Hi,
I have noticed that aperm is very slow, and I wondered if there was a
way of speeding it up.
Let me tell you a bit about the context of my problem, because perhaps
I shouldn't be using aperm at all.
The context is probabilistic inference in
graphical models. One of the most fundamental operations is two
compute an element-wise multiplication of two arrays of different
sizes, say A and B.
2024 Oct 31
2
Error compiling 87283 on Windows 10 using Rtools4.4 6335-6327
When compiling R, the build fails after byte compiling grDevices with
the following error:
byte-compiling package 'grDevices'
make[4]: *** [../../../share/make/lazycomp.mk:9:
../../../library/grDevices/R/grDevices.rdb] Error 139
make[3]: *** [Makefile.win:23: all] Error 2
make[2]: *** [Makefile.win:34: R] Error 1
make[1]: *** [Makefile:18: all] Error 2
make: *** [Makefile:392:
2008 Aug 14
3
extending the derivs table/fools rushing in
I added "plogis" to the derivative table in the
development version of R; the patch against yesterday's
R-devel src/deriv/main.c is available at
http://www.zoology.ufl.edu/bolker/deriv_patch.txt .
I pretty much followed the framework of the other symbols;
here was my incantation
- } else if (CAR(expr) == PlogisSymbol) {
- ans = simplify(TimesSymbol,
-
2002 Jan 30
1
mosaicplot(formula, data)--- bugged?
I have been tinkering with mosaicplot() and friends as a way
of learning R. As part of this, I've written a pair.table()
method for mosaic matrices, and would like to extend mosaicplot
to work with loglin and logln (MASS) objects. I'm using
R 1.4.0 on Win 98.
I've been trying to figure out the formula interface, and think
there's a bug, but not sure how to find it, yet alone fix
2017 Sep 28
2
building random matrices from vectors of random parameters
Sure -- thanks -- only took me 3-4 attempts to get aperm to work (as
opposed to really thinking hard about how it works ;-)
On 9/28/2017 11:55 AM, Duncan Murdoch wrote:
> On 28/09/2017 9:10 AM, Evan Cooch wrote:
>> Thanks for both the mapply and array approaches! However, although
>> intended to generate the same result, they don't:
>>
>> # mapply approach
2006 Jun 09
1
Idempotent apply
Dear all,
I have been working on an idempotent version of apply, such that
applying a function f(x) = x (ie. force) returns the same array (or a
permutation of it depending on the order of the margins):
a <- array(1:27, c(2,3,4))
all.equal(a, iapply(a, 1, force))
all.equal(a, iapply(a, 1:2, force))
all.equal(a, iapply(a, 1:3, force))
all.equal(aperm(a, c(2,1,3)), iapply(a, 2, force))
2017 Sep 28
0
building random matrices from vectors of random parameters
The use of aperm is unnecessary if you call array() properly.
ms <- array(c(rep(0, 5),so,sa*m,sa), c(5, 2, 2))
--
Sent from my phone. Please excuse my brevity.
On September 28, 2017 9:10:26 AM PDT, Evan Cooch <evan.cooch at gmail.com> wrote:
>Sure -- thanks -- only took me 3-4 attempts to get aperm to work (as
>opposed to really thinking hard about how it works ;-)
>
>On
2010 Jun 19
1
more powerful iconv
R community,
As you may know, R's iconv doesn't work well converting to and from
encodings that allow embedded nulls. For example
> iconv("foo", to="UTF-16")
Error in iconv("foo", to = "UTF-16") :
embedded nul in string: '\xff\xfef\0o\0o\0'
However, I don't believe embedded nulls are at issue here, but rather
that R's iconv
1999 Jul 20
2
tensor() function and sets
Hi Everyone,
To complete the outer() and kronecker() functions in the base, may I
suggest the following tensor() function, which allows the multiplication
of arrays through sets of conformable dimensions. I am happy to write a
help page if required.
The code also needs a setdiff() function which prompts me to ask: what
about simple set functions? I expect many of us have written our own
2010 Jul 08
4
Duda con orden Cars93
Cordial saludo,
Estoy haciendo una grafica de la base de datos Cars93 conde relaciono
Manufacturer con Price con este codigo
library(MASS)
with(Cars93,plot(Manufacturer, Price, las=2, ylab="Precio (en $1,000)"))
necesito el comando para que queden ordenados de manera ascendente como en
la grafica 2, muchas gracias por su ayuda
Grafica 1
[image: M-P.JPG]
Grafica 2
[image: M-P
2024 Oct 31
1
Error compiling 87283 on Windows 10 using Rtools4.4 6335-6327
On 10/31/24 18:35, Avraham Adler wrote:
> On Thu, Oct 31, 2024 at 12:42?PM Tomas Kalibera
> <tomas.kalibera at gmail.com> wrote:
>> On 10/31/24 17:30, Avraham Adler wrote:
>>> When compiling R, the build fails after byte compiling grDevices with
>>> the following error:
>>>
>>> byte-compiling package 'grDevices'
>>> make[4]:
2009 Jul 31
1
help in using gsub and ?
Hi all,
I would like to strip the R prompt from a series of code lines and copy the resulting text into a R script. For example, consider the following :
#####
str1<-"
> library(MASS)
> data(Cars93)
> attach(Cars93)
> imosaic(data.frame(AirBags,Cylinders,Origin))"
str2<-gsub('>','',str1)
######
This gives, as expected .?
> str2
[1] "\n
2003 Oct 21
5
do.call() and aperm()
Hi everyone
I've been playing with do.call() but I'm having problems understanding it.
I have a list of "n" elements, each one of which is "d" dimensional
[actually an n-by-n-by ... by-n array]. Neither n nor d is known in
advance. I want to bind the elements together in a higher-dimensional
array.
Toy example follows with d=n=3.
f <-
2010 Apr 18
3
xtabs() of proportions, and naming a dimension (not a row)
Hi,
xtabs() creates a table of counts. I want a table of proportions -- that
is, I want to divide every vector (along a particular dimension) by its sum.
The tiny example below does that. The call to xtabs() creates a matrix "A"
with dimensions ("x1","x2","y"). I transform "A" using aperm() and aaply()
to get the matrix "B". The
2004 Sep 13
1
Rd files with "%" (was: permuting dimensions)
Professor Ripley
thanks for this. Very much appreciated.
The original subject line reflected my late-night conviction
that the answer might involve passing a strange list to do.call().
Anyway, package magic is broken (only in R-devel, I might add) because I have
a function called "%eq%".
R-2.0.0 CMD check is stopping (I think) because it interprets the
"%" as a
2004 Feb 10
1
make check in 1.8.1.
I just (finally!!!) got R version 1.8.1 to configure and build under
Solaris 9 (after much travail; there were funnies in my environment
variables that mucked things up, but that's another story).
Anyhow, when I ran ``make check'' I got an error right toward the
end. Looking in the directory ``tests'' I found that the error was
associated with the file reg-tests-3.R, and the
2001 Sep 08
2
Basic SPSS commands in R ?
Hello,
i'm newbie of R and think it is a really good alternative to SPSS.
But i have more problems using elementary things comparable with using advanced methods.
(1) How can i value label i.e the variable X in data.frame DATA
with the labels ( 1=very good ) (2=good).
spss syntax when DATA is in Spreadsheet is:
value labels X
1 'very good'.
2 'good'.
execute.
(2) How can i