Re: [R] Arrays of variable dimensionality

2015-05-30 Thread Henrik Bengtsson
Basically dropping by saying what's already been said, but also that you probably want to do whatever you're trying to achieve using vectorized operations. A small summary with some tweaks: ## Generate an array with a "random" number of dimensions dim <- c(4, 5, 6, 7) dimnames <- lapply(1:4, FUN=

Re: [R] zero in alternate elements in alternate rows in matrix

2015-05-30 Thread David Winsemius
On May 30, 2015, at 8:56 AM, Michelle Morters wrote: > Hi - I'm trying to generate the (toy) matrix below in R. I get the error > message shown below (and no matrix!) and I'm unclear as to why - if > someone could advise as to why, that would be ace. Thank you! Michelle > > > 0.7 0 0.

Re: [R] alternatives to KS test applicable to K-samples

2015-05-30 Thread David Winsemius
On May 29, 2015, at 10:02 AM, Cade, Brian wrote: > Wensui: There are the multi-response permutation procedures (MRPP) that > readily test the omnibus hypothesis of no distributional differences among > multiple samples for univariate or multivariate responses. There also are > empirical coverag

Re: [R] alternatives to KS test applicable to K-samples

2015-05-30 Thread Wensui Liu
thanks for your comment, Bert as pointed out by Brian, mrpp suits my need. On Sat, May 30, 2015 at 2:02 PM, Bert Gunter wrote: > ... or in not testing at all. The distributions are not the same, period. So > what. Testing for equality is useless -- the real question is: what issues > are you tryi

Re: [R] puzzling behaviour of identical function

2015-05-30 Thread William Dunlap
Their 'srcref' attributes differ. srcref describes the text that the parser was given when creating the function. > identical(f1 <- function(x)1, f2 <- function(x)1) [1] FALSE > str(f1) function (x) - attr(*, "srcref")=Class 'srcref' atomic [1:8] 1 17 1 28 17 28 1 1 .. ..- attr(*, "srcfile")=

Re: [R] puzzling behaviour of identical function

2015-05-30 Thread Duncan Murdoch
On 30/05/2015 10:35 AM, Munawar Cheema wrote: > I am puzzled by the following seemingly contradictory calls to the function > identical. Below is a minimal example, that reproduces them: > >> sessionInfo() > R version 3.2.0 (2015-04-16) > Platform: x86_64-apple-darwin13.4.0 (64-bit) > Running unde

[R] please ignore previous e-mail re zeros in alternate rows & alternate elements in matrix

2015-05-30 Thread Michelle Morters
Sorry - I have solved my problem already - please don't post the request for advice on how to generate a matrix with zeros in alternate rows & alternate elements in the supra-diagonal Cheers Michelle __ R-help@r-project.org mailing list -- To UNSUBSC

[R] zero in alternate elements in alternate rows in matrix

2015-05-30 Thread Michelle Morters
Hi - I'm trying to generate the (toy) matrix below in R. I get the error message shown below (and no matrix!) and I'm unclear as to why - if someone could advise as to why, that would be ace. Thank you! Michelle 0.7 0 0.1 0 0.1 0 0 0 0 0 0

[R] puzzling behaviour of identical function

2015-05-30 Thread Munawar Cheema
I am puzzled by the following seemingly contradictory calls to the function identical. Below is a minimal example, that reproduces them: > sessionInfo() R version 3.2.0 (2015-04-16) Platform: x86_64-apple-darwin13.4.0 (64-bit) Running under: OS X 10.9.5 (Mavericks) locale: [1] C attached base pa

Re: [R] alternatives to KS test applicable to K-samples

2015-05-30 Thread Bert Gunter
... or in not testing at all. The distributions are not the same, period. So what. Testing for equality is useless -- the real question is: what issues are you trying to address/ what questions are you trying to answer/ can they be answered with the data you have or plan to get? In any case, this

Re: [R] alternatives to KS test applicable to K-samples

2015-05-30 Thread David Winsemius
On May 30, 2015, at 7:09 AM, Wensui Liu wrote: > Thanks for your insight, David > But I am not interested in comparing means among multiple groups. > Instead, I want to compare empirical distributions. In this case, I am > not sure if wilcoxon should be still applicable. > > still appreciate it.

Re: [R] Arrays of variable dimensionality

2015-05-30 Thread Jeff Newmiller
Don't. Arrays in R don't have variable dimensions [1]. To the extent that you pretend otherwise, you will degrade performance and complicate your program. I would argue that similar effects arise in languages that do let you pretend that arrays have variable dimensions. The main reason variabl

Re: [R] Arrays of variable dimensionality

2015-05-30 Thread William Dunlap
I don't know for sure what result you want, but it may be that using a length(dim(array))-column matrix as your subscript will do what you want. E.g., > a <- array(101:124, dim=4:2) > subscriptMatrix <- cbind(c(1,3), c(2,2), c(2,1)) > subscriptMatrix [,1] [,2] [,3] [1,]12

Re: [R] alternatives to KS test applicable to K-samples

2015-05-30 Thread Wensui Liu
Thanks for your insight, David But I am not interested in comparing means among multiple groups. Instead, I want to compare empirical distributions. In this case, I am not sure if wilcoxon should be still applicable. still appreciate it. On Fri, May 29, 2015 at 1:32 PM, David Winsemius wrote: >

Re: [R] metagen - plotStudySizes: order by year and not alphabetical

2015-05-30 Thread John Kane
Adding a bit of formatting Where your data is dat1 dat1$reference <- factor(dat1$reference, levels = dat1$reference[order(dat1$year)]) pp2 <- ggplot(dat1, aes( reference, size)) + geom_bar( stat = "identity") + coord_flip() pp2 <- pp2 + ggtitle("Studies with Cross-sectional estimates") +

Re: [R] Toronto CRAN mirror 403 error?

2015-05-30 Thread Mark Drummond
> It's possible that the mirror manager is unaware of this, and might like > to be informed. I know him, and will send an email. > > Duncan Murdoch Thanks Duncan. -- Cheers, Mark __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see h

Re: [R] metagen - plotStudySizes: order by year and not alphabetical

2015-05-30 Thread John Kane
Yes you can do it fairly easily in 'basic' ggplot2. You need to change the references from factors to ordered factors and then plot. Note your data is now called dat1 as df is an R function. Do ?df to see what it is. dat1$reference <- factor(dat1$reference, levels = dat1$reference[order(dat1

Re: [R] Toronto CRAN mirror 403 error?

2015-05-30 Thread Mark Drummond
I am using another mirror. Just being a good net.citizen. On Fri, May 29, 2015 at 11:03 PM, Jeff Newmiller wrote: > This is why there are mirrors. You don't have to wait for them or tell > them to do their jobs. > --- > Jeff

[R] metagen - plotStudySizes: order by year and not alphabetical

2015-05-30 Thread Antonello Preti
HI everybody. I'm using the package 'metagen' to plot sample size in meta-analysis. The plot function of the package reorders the studies by alphabetcial order. However, I would like to have the studies listed by year. How can I force the plotting function to order the study by the variable 'year'

Re: [R] lapply function

2015-05-30 Thread Sarah Goslee
You need the vectorizes ifelse() instead of if(). Also watch out for order of operations in the last line, and there is already a base R function named scale(). And spelling of arguments, of course. On Saturday, May 30, 2015, Sohail Khan wrote: > Hi R Gurus, > > I am writing a simple function t

[R] lapply function

2015-05-30 Thread Sohail Khan
Hi R Gurus, I am writing a simple function that take a numeric vector column from a data frame and scales the vector column with certain criteria. I would then pass this function to a list of dataframes by lappy. Question is how do I write a function that works on a numeric vector. My function

Re: [R] Arrays of variable dimensionality

2015-05-30 Thread Prof Brian Ripley
On 30/05/2015 11:29, WRAY NICHOLAS wrote: Hello folks Supposing I have a multidimensional array in an R prog, say a 4D array. I want the coordinate quantities to be read off from a vector. The values in the vector (vec) are generated by a function. It is not clear what you want to do. This

Re: [R] Toronto CRAN mirror 403 error?

2015-05-30 Thread Duncan Murdoch
On 29/05/2015 11:27 PM, David Winsemius wrote: > > On May 29, 2015, at 7:12 PM, Mark Drummond wrote: > >> I've been getting a 403 when I try pulling from the Toronto CRAN mirror >> today. >> >> http://cran.utstat.utoronto.ca/ > > Right. It's been out for the last 2.7 days: > > http://cran.r-pro

Re: [R] Arrays of variable dimensionality

2015-05-30 Thread Jim Lemon
Hi Nick, Does length(dim(X)) help by getting the current dimensions of the array before you pass the vectors of indices? Jim On Sat, May 30, 2015 at 8:29 PM, WRAY NICHOLAS wrote: > Hello folks > > Supposing I have a multidimensional array in an R prog, say a 4D array. > > I want the coordinate

[R] Arrays of variable dimensionality

2015-05-30 Thread WRAY NICHOLAS
Hello folks Supposing I have a multidimensional array in an R prog, say a 4D array. I want the coordinate quantities to be read off from a vector. The values in the vector (vec) are generated by a function. This is easy if the number of dimensions is fixed for both the array and the number of e