search for: aapli

Displaying 20 results from an estimated 20 matches for "aapli".

Did you mean: aapl
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 29
0
interesting behavior from aaply
Dear helpers, I'm using plyr to process a large matrix for the first time. My code is set up to work with matrixes, since I learned the hard way that dataframes are considerably slower to process. I started using aaply(), but the data was rearranged from a flat matrix to a [, , 4] array for larger input matrixes. I'm sure something clever is happening that I'm just not seeing -
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
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 Dec 05
3
data manipulation between vector and matrix
Dear list, I was curious how to subtract a vector from matrix? Say, I have mat <- matrix(1:40, nrow=20, ncol=2) x <-c(1,2) I want, x-mat[1,] and x-mat[2,], and so on... Basically, subtract column elements of x against column elements in mat. But x-mat won't do it. Thanks, Mike [[alternative HTML version deleted]]
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
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
2008 Sep 30
0
New package: plyr
plyr is a set of tools that solves a common set of problems: you need to break a big problem down into manageable pieces, operate on each pieces and then put all the pieces back together. It's already possible to do this with split and the apply functions, but plyr just makes it all a bit easier with: * consistent names, arguments and outputs * input from and output to data.frames,
2010 Jan 20
1
min and max operations on matrix
Folks, I've got a matrix x as follows: > x <- matrix(c(1,2,3,5,3,4,3,2,1), ncol = 3, byrow = TRUE) > x [,1] [,2] [,3] [1,] 1 2 3 [2,] 5 3 4 [3,] 3 2 1 In each row of x, I want to replace the minimum value by -1, the maximum value by +1 and all other values by 0. So in the above case I want to end up as follows: [,1] [,2] [,3] [1,] -1 0
2008 Sep 30
0
New package: plyr
plyr is a set of tools that solves a common set of problems: you need to break a big problem down into manageable pieces, operate on each pieces and then put all the pieces back together. It's already possible to do this with split and the apply functions, but plyr just makes it all a bit easier with: * consistent names, arguments and outputs * input from and output to data.frames,
2008 Dec 18
1
Newbie "if" problem
I have got a general problem when applying a function to a dataframe using the function; Apply(df,1,myfunct) Where myfunct has an IF statement in it along the lines of; If (z == 0) X = 1 If (z ==0) Z = 1 I.e. Two If statements Is there something I am missing or have a just formed the if statements wrong ­ just checking there is not some trick you have to use when using apply with functions
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
2012 Jan 12
1
parallel computation in plyr 1.7
Dear all, I have a question regarding the possibility of parallel computation in plyr version 1.7. The help files of the following functions mention the argument '.parallel': ddply, aaply, llply, daply, adply, dlply, alply, ldply, laply However, the help files of the following functions do not mention this argument: ?d_ply, ?aply, ?lply Is it because parallel computation is not
2011 Feb 15
1
matrixStats: Extend to arrays too (Was: Re: Suggestion: Adding quick rowMin and rowMax functions to base package)
Hi. On Sun, Feb 13, 2011 at 10:18 AM, TakeoKatsuki <takeo.katsuki at gmail.com> wrote: > > Hi Henrik, > > It would be nice if functions of the matrixStats package can handle array > data. > For example, rowSums() of the base package sums along the third axis of an > array by rowSums(x, dim=2). That is a good idea. This was indeed the initial objective before starting
2013 Mar 22
1
Median across matrices
Hey all, I have a list of matrices. I'd like to calculate the median across all those matrices for each element. What I'd like to end up with is a matrix containing the median of all [1,1] [1,2] etc. elements across all matrices. Is there a concise way of doing that? Thanks!
2009 Apr 15
0
plyr version 0.1.7
plyr is a set of tools for a common set of problems: you need to break down a big data structure into manageable pieces, operate on each piece and then put all the pieces back together. For example, you might want to: * fit the same model to subsets of a data frame * quickly calculate summary statistics for each group * perform group-wise transformations like scaling or standardising *
2009 Apr 15
0
plyr version 0.1.7
plyr is a set of tools for a common set of problems: you need to break down a big data structure into manageable pieces, operate on each piece and then put all the pieces back together. For example, you might want to: * fit the same model to subsets of a data frame * quickly calculate summary statistics for each group * perform group-wise transformations like scaling or standardising *
2013 Jan 16
4
Changing frequency values to 1 and 0
Dear list, I'm working with a large data set, where I grouped several species in one group (guild). Then I reshaped my data as shown below. Now, I just want to have "Rep" only as 1 or 0. I'm not being able to change the values of rep>=1 to 1... tried many things and I'm not being successful! > melting=melt(occ.data,id.var=c("guild", "Site",
2010 Jan 25
5
Data transformation
Dear all, I have a dataset that looks like this: x <- read.table(textConnection("col1 col2 3 1 2 2 4 7 8 6 5 10"), header=TRUE) I want to rewrite it as below: var1 var2 var3 var4 var5 var6 var7 var8 var9 var10 1 0 1 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 1 0 0
2010 Jan 19
4
apply command
Can you please help on the issue? I using the apply command on a matrix below the example: Create a vector x =c(5, 3, 2:4, NA, 7, 3, 9, 2, 1, 5) create a matrix of 2 rows by 6 columns b=matrix(x, 2,6) print(b) [,1] [,2] [,3] [,4] [,5] [,6] [1,] 5 2 4 7 9 1 [2,] 3 3 NA 3 2 5 using the command apply print(apply(b, 1, function(y) sort(y, na.last=F))) the