Displaying 20 results from an estimated 10000 matches similar to: "apply() returning a list?"
2010 Dec 15
3
Help with RGL package problem
Hello,
I have been experiencing an odd error with the RGL package that I cannot
figure out. I have searched without luck for fixes to this problem on
Rseek, Google, and the R-help-list.
RGL used to work on my machine about a month ago. It was a very useful
tool. The graphics device will not initialize now, and I cannot figure out
why.
When I try to load the package using ...
>
2014 Oct 10
1
dumping using tftp
Hi
Yeah I ended up figuring it out
My usage for the tool will be to gather hardware specs of new servers that we receive and servers we have in storage
I will then see if I can script something to phrase the dumps to update our inventory tool.
Our main issue is that gathering information manually by opening the server and having to locate each parts is time consuming and being humans we are
2013 Mar 03
1
Missing PROTECT in mkPRIMSXP ?
The Bioconductor build for a package DirichletMultinomial on
R Under development (unstable) (2013-02-26 r62077) -- "Unsuffered Consequences"
at
http://bioconductor.org/checkResults/devel/bioc-LATEST/DirichletMultinomial/george2-buildsrc.html
shows
* creating vignettes ... ERROR
...
Error: processing vignette ?DirichletMultinomial.Rnw? failed with diagnostics:
chunk 21 (label
2011 Feb 02
2
Help me apply mapply
Hello all I would like to ask your help use mapply.
I have a function called findCell that takes two arguments(x,sr)
where x is a vector of size two (e.g x<-c(2,3) and sr is a matrix.
I would like to call many times the findCell function (thus I need mapply) for different x inputs but always for the same sr.
as x is a vector of size two (two cells) I want to pass inside inside the following
2013 Mar 10
2
list + lapply insead of matrix + apply
I need to develop a simple list manipulation. Although it seems easier to
do it in matrix form, but I need it in list form.
I have a matrix
x <- matrix(c(12.1, 3.44, 0.1, 3, 12, 33.1, 1.1, 23), nrow=2)
for list form example, the conversion is
x.list <- lapply(seq_len(nrow(x)), function(i) x[i,])
### list version
calcnorm=function(a, b){
diff <- mapply("-", a, b)
2003 Dec 16
3
`bivariate apply'
dear all,
Given a matrix A, say, I would like to apply a bivariate function to each
combination of its colums. That is if
myfun<-function(x,y)cor(x,y) #computes simple correlation of two vectors x
and y
then the results should be something similar to cor(A).
I tried with mapply, outer,...but without success
Can anybody help me?
many thanks in advance,
vito
2014 Oct 09
2
dumping using tftp
Hello,
I'm not quite sure I understand how do you use HDT for dumping over tftp server.
The wiki on dumping does not offer much details on how to set this up.
>From my understanding is you need to run pxelinux somewhere but being that HDT is a bootable cd ISO,
I don't see how I can get HDT up from a TFTP server without the need to install something on that TFTP server.
Is there a more
2006 Aug 31
2
Wish: keep names in mapply() result
Hello!
I have noticed that mapply() drops names in R 2.3.1 as well as in
r-devel. Here is a simple example:
l <- list(a=1, b=2)
k <- list(1)
mapply(FUN="+", l, k)
[1] 2 3
mapply(FUN="+", l, k, SIMPLIFY=FALSE)
[[1]]
[1] 2
[[2]]
[1] 3
Help page does not indicate that this should happen. Argument USE.NAMES
does not have any effect here as it used only in a bit special
2012 Mar 06
1
How to apply two parameter function in data frame
I know this is something simple that I cannot do because I do not yet "think"
in R.
I have a data frame has a variable participation (a factor), and several
other factors.
I want a chisq test (no contingency tables) for participation vs all of the
other factors.
In SPSS I would do:
CROSSTABS
/TABLES= (my other factors) BY participation
/FORMAT=NOTABLES
/STATISTICS=CHISQ
2012 Jul 21
1
memory size
Dear R community,
I'm running "a mlogit" function with a very large data set. Since the data
size is so large, I got the Error:
Error: cannot allocate vector of size 5.4 Mb
In addition: Warning messages:
1: In mapply("*", X, P, SIMPLIFY = FALSE) :
Reached total allocation of 16340Mb: see help(memory.size)
2: In mapply("*", X, P, SIMPLIFY = FALSE) :
Reached
2017 Sep 28
3
building random matrices from vectors of random parameters
Thanks for both the mapply and array approaches! However, although
intended to generate the same result, they don't:
# mapply approach
n = 3
sa <- rnorm(n,0.8,0.1)
so <- rnorm(n,0.5,0.1)
m <- rnorm(n,1.2,0.1)
mats = mapply(function(sa1, so1, m1)
matrix(c(0,sa1*m1,so1,sa1),2,2,byrow=T), sa, so, m, SIMPLIFY = FALSE)
print(mats)
[[1]]
????????? [,1]????? [,2]
[1,] 0.0000000
2016 Apr 03
1
apply mean function to a subset of data
Here are several ways to get there, but your original loop is fine once it is corrected:
> for (i in 1:2) smean[i] <- mean(toy$diam[toy$group==i][1:nsel[i]])
> smean
[1] 0.271489 1.117015
Using sapply() to hide the loop:
> smean <- sapply(1:2, function(x) mean((toy$diam[toy$group==x])[1:nsel[x]]))
> smean
[1] 0.271489 1.117015
Or use head()
> smean <- sapply(1:2,
2017 Sep 28
0
building random matrices from vectors of random parameters
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
>
> n = 3
> sa <- rnorm(n,0.8,0.1)
> so <- rnorm(n,0.5,0.1)
> m <- rnorm(n,1.2,0.1)
> mats = mapply(function(sa1, so1, m1)
> matrix(c(0,sa1*m1,so1,sa1),2,2,byrow=T),
2012 Aug 01
4
apply function over same column of all objects in a list
Hello. Please forgive me if this problem has already been posted (and solved)
by someone else ... I can't find it anywhere though it seems so very basic.
Here it is:
I have a list comprised of several matrices, each of which has two columns.
> list
[[1]]
[,1] [,2]
[1,] 1 3
[2,] 2 4
[[2]]
[,1] [,2]
[1,] 5 7
[2,] 6 8
[[3]]
[,1] [,2]
2006 Jul 19
7
Sync hardware clock
Does any know of a way to sync the hardware clock without a reboot?
Graham Johnston
Senior Network Analyst
Westman Communications Group
204.725.4300 ext 382
johnstong at westmancom.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.centos.org/pipermail/centos/attachments/20060719/70ef23ce/attachment-0002.html>
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
2009 Oct 14
1
using mapply to avoid loops
Hello, I would like to use mapply to avoid using a loop but for some reason, I can't seem to get it to work. I've included copies of my code below. The first set of code uses a loop (and it works fine), and the second set of code attempts to use mapply but I get a "subscript out of bounds" error. Any guidance would be greatly appreciated. Xj, Yj, and Wj are also lists, and s2,
2006 Sep 03
3
Merge list to list - as list
Dear all,
#Last week, I asked about merge x and y as list.
#Now I have a dataset with list of list like:
x <- list(list(matrix(1:20, 5, 4),matrix(1:20, 5, 4)),
list(matrix(1:20, 5, 4),matrix(1:20, 5, 4)))
y <- list(list(c(1, -1, -1, 1, 1),c(1, 1, -1, -1, -1)),
list(c(1, 1, 1, 1, 1),c(1, 1, -1, 1, -1)))
x
y
#I need merge x and y, I have tried with
list.uni <-
2012 Nov 15
1
bug with mapply() on an S4 object
Hi,
Starting with ordinary vectors, so we know what to expect:
> mapply(function(x, y) {x * y}, 101:106, rep(1:3, 2))
[1] 101 204 309 104 210 318
> mapply(function(x, y) {x * y}, 101:106, 1:3)
[1] 101 204 309 104 210 318
Now with an S4 object:
setClass("A", representation(aa="integer"))
a <- new("A", aa=101:106)
> length(a)
2009 Jun 03
1
Vectorize fails for function with ... arglist
Vectorize is defined to return a function that acts as if 'mapply' was
called.
So we have:
> mapply(dput,1:2) # mapply form
1L # calls dput on each element of 1:2
2L
[1] 1 2
> Vectorize(dput)(1:2) # Vectorize form
1L # same behavior
2L
[1] 1 2
Same thing with a named argument:
>