similar to: Sorting rows of a matrix independent of each other

Displaying 20 results from an estimated 1000 matches similar to: "Sorting rows of a matrix independent of each other"

2009 Mar 01
1
Combining 2 arrays into a third array via a function
I'm completely stumped and seem to be going around for 2 days in the wrong circles. Here's what I have in 2 dataframes: > dim(params.data); head(params.data, n=2) [1] 284 6 item a1 a2 b1 b2 c 1 1 0.6671587 0.9588642 -3.5 -3.437961 0.2 2 2 1.1296298 1.4899307 -3.5 -4.146118 0.2 > dim(examinees.data); head(examinees.data, n=2) [1] 1600 3 examinee
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
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
2013 Apr 05
2
How to perform a grouped shapiro wilk test on dataframe
Hello, I was wandering if it is possible to perform on a dataframe called 'all' a shapiro wilk normality test for COUNTS by variable Group ACTIVITY? Could it be done using plyer? I saw an eg that applies to an array but not to a dataframe: lapply(split(dataset1$Height,dataset1$Group),shapiro.test) Any thoughts would be much appreciated. My dataframe is in shape: dat ACTIVIT
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
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
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
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
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
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!
2013 Apr 03
5
Can package plyr also calculate the mode?
I am trying to replicate the SAS proc univariate in R. I got most of the stats I needed for a by grouping in a data frame using: all1 <- ddply(all,"ACT_NAME", summarise, mean=mean(COUNTS), sd=sd(COUNTS), q25=quantile(COUNTS,.25),median=quantile(COUNTS,.50), q75=quantile(COUNTS,.75), q90=quantile(COUNTS,.90), q95=quantile(COUNTS,.95), q99=quantile(COUNTS,.99) )
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
2001 Nov 26
3
Encoding or Playback problem?
Hi all, Have trouble encoding / playing back OGG using WinAmp + plugin. I encoded the files from .WAV with Ogg drop RC2. Seems to be ok. When I try and play them back though I get very very weird sound effects (some kind of "wobbling", some bass frequencies that are usually in the background seem to get more emphasised and they seem to have some kind of strange echo / reverb to it
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
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 -
2024 Feb 21
1
Cant access home folder after 4.13.x
The users in LDAP appear as local users on my file server using the /etc/nsswitch.conf passwd: files ldap group: files ldap [root at fs ~]# getent passwd | grep kev kev:x:10000:10001:Kev:/home/fukr/kev:/bin/bash [root at fs ~]# getent group | grep kev net-users::10001:kev net-admins::10000:kev media::10002:kev Kerberos is working fine, so is NTP and DNS. My problem is that my issue
2024 Feb 21
1
Cant access home folder after 4.13.x
Hi I've been using Samba from pkgsrc successfully on Illumos, SmartOS specifically until I moved to 4.17.11. When I try to access my home folder on Linux I get, chdir_current_service: vfs_ChDir(/home/fukr/kev) failed: Permission denied. Current token: uid=10000, gid=10001, 3 groups: 10001 10000 10002 My home folder permissions are 700. If I change to 755 it works fine. My the uid, gid are,