Displaying 20 results from an estimated 2000 matches similar to: "vertical list sum"
2010 Oct 31
1
R-help Digest, Vol 92, Issue 31
Hi, I'd like to unsubscribe from the list.
Thanks
Neyra
________________________________
De: "r-help-request@r-project.org" <r-help-request@r-project.org>
Para: r-help@r-project.org
Enviado: sáb, octubre 30, 2010 5:30:07 AM
Asunto: R-help Digest, Vol 92, Issue 31
Send R-help mailing list submissions to
r-help@r-project.org
To subscribe or unsubscribe via the
2007 Jun 02
1
Calculating column percentages of a table
Hello,
I know, this is a real newbie question, but I can't find anything on this in
the manuals! I know that I get calculate the column totals of a table with
`apply(mytable, 2, sum)'. Now I want each column total to be 100% and
calculate the percentage of each field of the column. How would I do that?
Rcommander, the ultimate newb-tool, has a function `colPercents' which is
exactly
2008 Sep 05
5
Lowest k values of list
Hi @ all,
how do I get the largest or lowest k values of list? It must similar to the min() / max() function, but I just don't get it.
Best wishes,
Markus
2010 Jul 27
2
Sum list elements
Hi!
I have a list of 24 elements, all of the same type (dataframe, for example).
I am looking for an alternative to mylist[[1]] + mylist[[2]] + ... +
mylist[[24]] to obtain the sum.
Anyone can help me?
Thanks in advance.
Nicola S.
[[alternative HTML version deleted]]
2009 May 19
3
how to calculate means of matrix elements
useR's,
I have several matrices of size 4x4 that I want to calculate means of their
respective positions with. For example, consider I have 3 matrices given by
the code:
mat1 <- matrix(sample(1:20,16,replace=T),4,4)
mat2 <- matrix(sample(-5:15,16,replace=T),4,4)
mat3 <- matrix(sample(5:25,16,replace=T),4,4)
The result I want is one matrix of size 4x4 in which position [1,1] is the
2015 May 04
2
Define replacement functions
Hello
I tried to define replacement functions for the class "mylist". When I test them in an active R session, they work -- however, when I put them into a package, they don't. Why and how to fix?
make_my_list <- function( x, y ) {
return(structure(list(x, y, class="mylist")))
}
mylist <- make_my_list(1:4, letters[3:7])
mylist
mylist[['x']] <- 4:6
2017 Jun 15
4
is.null(mylist[1]) and is.null(mylist$a) returns different values
Hi
I have a list :
mylist <- list( a = NULL, b = 1, c = 2 )
> mylist[1]
$a
NULL
> is.null(mylist[1])
[1] FALSE
> is.null(mylist$a)
[1] TRUE
why? I need to use mylist[1]
2009 Oct 25
3
NULL elements in lists ... a nightmare
I can define a list containing NULL elements:
> myList <- list("aaa",NULL,TRUE)
> names(myList) <- c("first","second","third")
> myList
$first
[1] "aaa"
$second
NULL
$third
[1] TRUE
> length(myList)
[1] 3
However, if I assign NULL to any of the list element then such
element is deleted from the list:
> myList$second <-
2010 May 17
3
applying quantile to a list using values of another object as probs
Hi r-users,
I have a matrix B and a list of 3x3 matrices (mylist). I want to
calculate the quantiles in the list using each of the value of B as
probabilities.
The codes I wrote are:
B <- matrix (runif(12, 0, 1), 3, 4)
mylist <- lapply(mylist, function(x) {matrix (rnorm(9), 3, 3)})
for (i in 1:length(B))
{
quant <- lapply (mylist, quantile, probs=B[i])
}
But quant
2005 Mar 16
8
Summing up matrices in a list
Dear all,
I think that my question is very simple but I failed to solve it.
I have a list which elements are matrices like this:
>mylist
[[1]]
[,1] [,2] [,3]
[1,] 1 3 5
[2,] 2 4 6
[[2]]
[,1] [,2] [,3]
[1,] 7 9 11
[2,] 8 10 12
I'd like to create a matrix M<-mylist[[1]]+mylist[[2]]
[,1] [,2] [,3]
[1,] 8 12 16
[2,] 10 14 18
2001 Oct 18
2
Parsing for list components
How do I parse an identifier of a list component, e.g.
mylist$mycomponent
or
mylist[[1]] ?
Parse does not do the job, e.g.
parse(text="mylist$mycomponent")
returns an expression with just one term, instead of "mylist", "$",
"mycomponent".
What I need is a way to extract the list name (e.g. "mylist"), given
an identifier of a component.
2010 Sep 04
4
Please explain "do.call" in this context, or critique to "stack this list faster"
I've been doing some consulting with students who seem to come to R
from SAS. They are usually pre-occupied with do loops and it is tough
to persuade them to trust R lists rather than keeping 100s of named
matrices floating around.
Often it happens that there is a list with lots of matrices or data
frames in it and we need to "stack those together". I thought it
would be a simple
2004 May 10
2
Lists and outer() like functionality?
Hi,
I'm have a list of integer vectors and I want to perform an outer()
like operation on the list. As an example, take the following list:
mylist <- list(1:5,3:9,8:12)
A simple example of the kind of thing I want to do is to find the sum
of the shared numbers between each vector to give a result like:
result <- array(c(15,12,0,12,42,17,0,17,50), dim=c(3,3))
Two for() loops is the
2012 Aug 28
3
Get variable data Reading from the list
Here i have a variable
MyVar <- data.frame(read.csv("D:\\Doc.csv"))
And now i am storing this variable name into a list.
MyList <- list()
MyList [length(MyList )+1]<- "MyVar"
Now what is the requirement is,
i need to call the variable name "MyVar" from the list "MyList " and get
the data.
2007 Jun 29
2
regexpr
Hi,
I 'd like to match each member of a list to a target string, e.g.
------------------------------
mylist=c("MN","NY","FL")
g=regexpr(mylist[1], "Those from MN:")
if (g>0)
{
"On list"
}
------------------------------
My question is:
How to add an end-of-string symbol '$' to the to-match string? so that 'M'
won't
2011 May 25
3
Accessing elements of a list
I have a list that is made of lists of varying length. I wish to create a
new vector that contains the last element of each list. So far I have used
sapply to determine the length of each list, but I'm stymied at the part
where I index the list to make a new vector containing only the last item
of each list
mylist =
2007 Oct 20
1
Getting at what a named object represents in a function...
Hi,
I'm pretty new to R.
I have an object (say a list) and I I have a function that I call on
various columns in that list (excuse terminology if it's wrong/ambiguous).
Imagine its like this (actual values are unimportant) and called mylist:
>mylist
A B
1 5
2 5
3 6 4 8
5 0
I have a function:
foo = function(param){
#modify list A or B values depending on
2005 Jan 30
3
trellis graphics in loops
I have this awkward problem with trellis (lattice). I am trying to
generate some plots through loops but the .eps file is empty. When I
generate them in a list and print them outside the loop all is fine. this
is an example below:( nothing shows up in foo.eps, but all show up in
foo1.eps)
R vesion 2.0.1, lattice version 0.10-16, on a debian 2.6.8-1 kernel.
X <- data.frame(x=rnorm(10000),
2004 Nov 01
5
make apply() return a list
Hi,
I have a dataframe (say myData) and want to get a list (say myList) that
contains a matrix for each row of the dataframe myData. These matrices are
calculated based on the corresponding row of myData. Using a for()-loop to do
this is very slow. Thus, I tried to use apply(). However, afaik apply() does
only return a list if the matrices have different dimensions, while my
matrices have
2011 Apr 05
1
Help in splitting a list
Dear R users,
Let's say I have a list with components being 'm' matrices (as exemplified
in the "mylist" object below). Now, I'd like to subset this list based on an
index vector, which will partition each matrix 'm' in 2 sub-matrices. My
questions are:
1. Is there an elegant way to have the results shown in mylist2 for an
arbitrary number of matrices in mylist?