Displaying 20 results from an estimated 3000 matches similar to: "Median across matrices"
2011 Sep 20
1
means across list of data frames
I have a list of data frames like the following:
set.seed(123)
a<- data.frame(x=runif(10), y = runif(10), sample = seq(1,10))
b<- data.frame(x=runif(10), y = runif(10), sample = seq(1,10))
L<- list(a,b)
All data frames in the list have the same dimensions. I need to calculate
the sample means for x and y. The real data are lists of several thousand
quite large dataframes, so I need
2010 Oct 03
1
plyr: a*ply with functions that return matrices-- possible bug in aaply?
I have an application where I have a function to calculate results for
a 2-way table or matrix, which
returns a matrix with one less row and column. To keep this short, the
function below captures the structure:
fun2way <- function(f){
if (!length(dim(f)) ==2) stop("only for 2-way arrays")
R <- dim(f)[1]
C <- dim(f)[2]
f[1:(R-1), 1:(C-1)]
}
Now, I want to
2013 Apr 10
6
means in tables
Hi.
I have 2 tables, with same dimensions (8000 x 5). Something like:
tab1:
V1 V2 V3 V4 V5
14.23 1.71 2.43 15.6 127
13.20 1.78 2.14 11.2 100
13.16 2.36 2.67 18.6 101
14.37 1.95 2.50 16.8 113
13.24 2.59 2.87 21.0 118
tab2:
V1 V2 V3 V4 V5
1.23 1.1 2.3 1.6 17
1.20 1.8 2.4 1.2 10
1.16 2.6 2.7 1.6 11
1.37 1.5 2.0 1.8 13
1.24 2.9 2.7 2.0 18
I need generate a table of averages, the
2011 Nov 10
2
Listing tables together from random samples from a generated population?
.
HI there,
I'd like to show demonstrate how the chi-squared distribution works, so I've come up with a sample data frame of two categorical variables
y<-data.frame(gender=sample(c('Male', 'Female'), size=100000, replace=TRUE, c(0.5, 0.5)), tea=sample(c('Yes', 'No'), size=100000, replace=TRUE, c(0.5, 0.5)))
And I'd like to create a list of 100
2002 Mar 13
1
several bugs (PR#918) lists and matrices
### I got bit again by the same bugs I wrote about a year ago.
### The bugs are related to matrices and arrays of lists.
### 1. There is a clear inconsistency in how R handles two
### functionally equivalent statements.
### array() is able to take a list and create a matrix.
### matrix() is unable to create that matrix.
> vector("list", 2)
[[1]]
NULL
[[2]]
NULL
>
2006 Apr 24
5
merging one array into another
Is there no better way to merge one array into another than iterating over the
array you wish to append with each() and push()ing the elements on to the
other array?
Here''s what I mean:
var arr1 = [1, 2, 3, 4, 5];
var arr2 = [''a'', ''b'', ''c''];
$A(arr2).each(function(el) { arr1.push(el) });
Is there no better way to do it than this?
2013 Apr 27
2
Polynomial Regression and NA coefficients in R
Hey all,
I'm performing polynomial regression. I'm simulating x values using runif() and y values using a deterministic function of x and rnorm().
When I perform polynomial regression like this:
fit_poly <- lm(y ~ poly(x,11,raw = TRUE))
I get some NA coefficients. I think this is due to the high correlation between say x and x^2 if x is distributed uniformly on the unit interval
2013 Feb 14
3
list of matrices --> array
i'm somehow embarrassed to even ask this, but is there any built-in
method for doing this:
my_list <- list()
my_list[[1]] <- matrix(1:20, ncol = 5)
my_list[[2]] <- matrix(20:1, ncol = 5)
now, knowing that these matrices are identical in dimension, i'd like
to unfold the list to a 2x4x5 (or some other permutation of the dim
sizes) array.
i know i can initialize the array, then
2014 Aug 01
2
[LLVMdev] Create "appending" section that can be partially dead stripped
Hi,
Is there a way in llvm IR to emit multiple data elements within a
single compilation unit that
a) are guaranteed to appear sequentially in the final binary (in the
order they appear in the llvm IR), and
b) will be removed on an individual basis by the optimizers and/or
linker in case they are not referenced from anywhere
?
Defining them as "appending" puts them all into a
2008 Aug 01
2
Storing Matrices into Hash
Hi,
Suppose I have these two matrices (could be more).
What I need to do is to store these matrices into a hash.
So that I can call back any of the matrix back later.
Is there a way to do it?
> mat_1
[,1] [,2]
[1,] 9.327924e-01 0.067207616
[2,] 9.869321e-01 0.013067929
[3,] 9.892814e-01 0.010718579
[4,] 9.931603e-01 0.006839735
[5,] 9.149056e-01 0.085094444
2012 Aug 26
1
Multiple lattice levelplots from matrices
Dear R-users,
My goal is to construct a levelplot (from the lattice package) with 4 or more individual plots sharing the same colorkey. While this appears to be relatively simple using functions, I haven't been able to find a solution using data matrices. An example of a working levelplot with just one matrix:
d <- replicate(10,rnorm(10))
levelplot(d)
I have found partial solutions using
2013 Mar 15
2
missing values in an array
Dear All,
I've an array with some missing values (NA) in between. I want to remove
that particular matrix if a missing value is detected. How can I do so?
Thank you very much.
Best regards,
Ray
[[alternative HTML version deleted]]
2009 Jul 14
2
averaging two matrices whilst ignoring missing values
Hi folks,
I'm trying to do something that seems like it should easy, but it apparently isn't. I have two large matrices, both containing a number of missing values at different cells. I would like to average these matrices, but the NAs are preventing me. I get a "non-numeric argument to binary operator" error. That's the first problem.
2008 Jun 04
4
sum of unknown number of matrices
Hi R,
I have a list of matrices. I need to get the sum of all the matrices in
the list.
Example:
a=b=c=d=matrix(1:4,2,2)
l=list(a,b,c,d)
I need:
> a+b+c+d
[,1] [,2]
[1,] 4 12
[2,] 8 16
Something like do.call("+",l) is not working...why is this?
I may not be knowing the number of matrices in the list...
Thanks, Shubha
This e-mail
2012 Jan 24
1
List to Array: How to establish the dimension of the array
Given a variable aa in the workspace, some of its attributes are:
> typeof(aa)
[1] "list"
> mode(aa)
[1] "list"
> length(aa)
[1] 2
How do I retrieve the maximum indices, in this case 2,3,4? The variable itself is:
> aa
[[1]]
[[1]][[1]]
[[1]][[1]][[1]]
[1] 37531.52
[[1]][[1]][[2]]
[1] 62787.32
[[1]][[1]][[3]]
[1] 5503.184
[[1]][[1]][[4]]
[1] 33832.8
2009 Mar 13
4
Sorting rows of a matrix independent of each other
Oh, this seemed so simple (and I'm sure the answer will be, as usual, so
thanks in advance for enlightening me). I need to sort each row of a matrix
independent of the others. For example,
> test <- matrix(c(8,7,1,2,6,5,9,4,3),nrow=3)
> test
[,1] [,2] [,3]
[1,] 8 2 9
[2,] 7 6 4
[3,] 1 5 3
I can get each row sorted well enough.
> sort(test[1,])
[1]
2012 Jan 28
2
Need very fast application of 'diff' - ideas?
Hi everyone,
Speed is the key here.
I need to find the difference between a vector and its one-period lag (i.e. the difference between each value and the subsequent one in the vector). Let's say the vector contains 10 million random integers between 0 and 1,000. The solution vector will have 9,999,999 values, since their is no lag for the 1st observation.
In R we have:
#Set up input vector
2019 Jan 15
2
Reducing the number of ptrtoint/inttoptrs that are generated by LLVM
Hello Chandler,
> ```
> void f(int *arr1, int *arr2, int length) {
> intptr_t rel_offset = arr2 - arr1;
> int *arr1_end = arr1 + length;
> for (int *p = arr1; p < arr1_end; p += sizeof(int)) {
> do_something(p, p + rel_offset);
> }
> }
> ```
>
> For example, a common loop optimization technique is something like the
following in *pseudocode* (note
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
2023 Nov 22
1
mediaplayer for icecast streams?
you can pull it with jQuery via javascript for example evry 10 seconds,
and update the informations you want, at least its the way i do it.
Am 23.11.2023 um 00:13 schrieb Thomas Jensen:
> Thank you, Ben!
>
> I was afraid it would be very complicated to get the information
> extracted, but it was very simple. My only problem now is to find a way
> to update the text on the