Re: [R] Upper bands and lower bands

2017-06-01 Thread Pedro páramo
Sorry, For me a vector is a matrix with mx1 dimmensions. But it is true that it is not the way I correctly must talk in R. Can you guide me in what I´m trying to do? I´m trying to find what I want in Excel using something like a parabolic function but dind´t get yet (then to try to replicate in R

[R] Question on interpreting glmer() results

2017-06-01 Thread Sean Trott
Hello, I originally posted this on the stats stack exchange site, but given its focus on R software, it was removed -- so I figured I'd post here. I'm having trouble interpreting a change in effect direction and significance when I add an interaction term to my glmer() model. *Part 1* I ran an

Re: [R] Upper bands and lower bands

2017-06-01 Thread Bert Gunter
Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Thu, Jun 1, 2017 at 11:20 AM, Pedro páramo wrote: > Hi all > > I want to add a band of fluctuación (exponential

[R] Upper bands and lower bands

2017-06-01 Thread Pedro páramo
Hi all I want to add a band of fluctuación (exponential decreading) to a linear deacrecing values Imagine: I have a matrix like c(10,9,8,7,6,5,4,3,2,1) The thing is I want two new lines so that the máximum value of the new colum on the máximum is from 10% to 5% higher and the same lower for the

Re: [R] Upper bands and lower bands

2017-06-01 Thread Pedro páramo
I explain better: I have this percentage z<-1/(n*365) where n=20 so z is 0,000136986 Imagine: a matrix with length(n*365) so that matrix result is resultc( 1, 1-z result previous row-z result previous row-z 0) If I plot this is a linear decreasing line I want to plot an upper line wich i

Re: [R] Reversing one dimension of an array, in a generalized case

2017-06-01 Thread David Winsemius
> On Jun 1, 2017, at 9:51 AM, Roy Mendelssohn - NOAA Federal > wrote: > > Hi All: > > I have been looking for an elegant way to do the following, but haven't > found it, I have never had a good understanding of any of the "apply" > functions. > > A simplified idea is I have an array, say:

Re: [R] [spatstat] Convert shapefile to pixel image

2017-06-01 Thread Michael Sumner
Try fasterize, converting to spatstat from raster is straightforward, happy to help. https://github.com/ecohealthalliance/fasterize Cheers, Mije On Fri, 2 Jun 2017, 07:45 Rolf Turner, wrote: > > On 02/06/17 01:17, lluis.hurt...@uv.es wrote: > > > Dear all, > > > > I am currently working with t

Re: [R] odfWeave - A loop of the "same" data

2017-06-01 Thread Henrik Bengtsson
This is what the R.rsp (https://cran.r-project.org/package=R.rsp; I'm the author) and it's RSP markup is good at and was designed to handle. We're using it lots in report generation where we iterate of elements, e.g. over the 24 chromosomes. See Section 2.3 in https://cran.r-project.org/web/packag

Re: [R] [spatstat] Convert shapefile to pixel image

2017-06-01 Thread Rolf Turner
On 02/06/17 01:17, lluis.hurt...@uv.es wrote: Dear all, I am currently working with the spatstat package, using windows and pixel images. First: My aim is to transform a shapefile (see attached) into a pixel image. My idea is to start transforming the shapefile into a Spatial Polygon file:

Re: [R] Reversing one dimension of an array, in a generalized case

2017-06-01 Thread Roy Mendelssohn - NOAA Federal
Thanks again. I am going to try the different versions. But I probably won't be able to get to it till next week. This is probably at the point where anything further should be sent to me privately. -Roy > On Jun 1, 2017, at 1:56 PM, David L Carlson wrote: > > On the off chance that any

Re: [R] Reversing one dimension of an array, in a generalized case

2017-06-01 Thread David L Carlson
On the off chance that anyone is still interested, here is the corrected function using aperm(): z <- array(1:120,dim=2:5) f2 <- function(a, wh) { idx <- seq_len(length(dim(a))) dims <- setdiff(idx, wh) idx <- append(idx[-1], idx[1], wh-1) aperm(apply(a, dims, rev), idx) } all.eq

Re: [R] [FORGED] Re: Question on function "scatterplot3d"

2017-06-01 Thread Rolf Turner
On 02/06/17 03:02, Uwe Ligges wrote: On 01.06.2017 10:03, Rolf Turner wrote: On 01/06/17 19:54, Uwe Ligges wrote: A design flaw, whether the labels are cut depends somewhat on the sizce of the device, hence there is the argument y.margin.add add additional space between tick mark labels an

Re: [R] Reversing one dimension of an array, in a generalized case

2017-06-01 Thread Roy Mendelssohn - NOAA Federal
Thank you. That ignores certain standards in the communities I work in, it also ignore the fact that whether I decide to always return increasing or decreasing latitudes, if the sources aren't consistent, then I need to reverse some of the data, no matter which way I decide. Increasing lat

Re: [R] Reversing one dimension of an array, in a generalized case

2017-06-01 Thread Ismail SEZEN
> On 1 Jun 2017, at 22:42, Roy Mendelssohn - NOAA Federal > wrote: > > Thanks to all for responses/. There was a question of exactly what was > wanted. It is the generalization of the obvious example I gave, > junk1 <- junk[, rev(seq_len(10), ] > > > so that > > junk[1,1,1 ] = jun

[R] subletting an array according to dimnames

2017-06-01 Thread li li
Hi all, I have a three dimensional array with the corresponding dimension names. I would like to subset the array according to the dimension names. For example, suppose I want to extract the values corresponding to A=20, B=10, C=0. I know I can do: P2[dimnames(P2)$A==20, dimnames(P2)$B==10, dim

Re: [R] [FORGED] How to create my own grDevices using java

2017-06-01 Thread Paul Murrell
Hi The 'RGraphicsDevice' package might be useful for this job. http://www.omegahat.net/RGraphicsDevice/ Paul On 01/06/17 07:09, Peter Cheung wrote: Hi All How to create my own grDevices using java, so that i can display the graphic from plot() in my java software? thanks from Peter

Re: [R] Latin Hypercube Sampling when parameters are defined according to specific probability distributions

2017-06-01 Thread Suzen, Mehmet
No it is an R programming questions. Nelly specifically asked you: "how can I use your code to apply my model to each of the 50 rows of the data frame “tabLHS”?" __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/

Re: [R] Reversing one dimension of an array, in a generalized case

2017-06-01 Thread Roy Mendelssohn - NOAA Federal
Thanks to all for responses/. There was a question of exactly what was wanted. It is the generalization of the obvious example I gave, >>> junk1 <- junk[, rev(seq_len(10), ] so that junk[1,1,1 ] = junk1[1,10,1] junk[1,2,1] = junk1[1,9,1] etc. The genesis of this is the program is downlo

Re: [R] Reversing one dimension of an array, in a generalized case

2017-06-01 Thread Ismail SEZEN
And my 2 cents, Rev <- function(x, margin) { newdim <- rep("", length(dim(x))) newdim[margin] <- paste(dim(x), ":1", sep = "")[margin] z <- eval(parse(text = gettextf("x[%s,drop = F]", paste(newdim, sep = "", collapse = ",")))

Re: [R] [FORGED] Re: Question on function "scatterplot3d"

2017-06-01 Thread li li
Thanks so much for the help!! Hanna 2017-06-01 11:02 GMT-04:00 Uwe Ligges : > > > On 01.06.2017 10:03, Rolf Turner wrote: > >> On 01/06/17 19:54, Uwe Ligges wrote: >> >>> A design flaw, whether the labels are cut depends somewhat on the sizce >>> of the device, hence there is the argument >>>

Re: [R] Reversing one dimension of an array, in a generalized case

2017-06-01 Thread David L Carlson
My error. Clearly I did not do enough testing. z <- array(1:24,dim=2:4) > all.equal(f(z,1),f2(z,1)) [1] TRUE > all.equal(f(z,2),f2(z,2)) [1] TRUE > all.equal(f(z,3),f2(z,3)) [1] "Attributes: < Component “dim”: Mean relative difference: 0.444 >" [2] "Mean relative difference: 0.6109091" #

Re: [R] [spatstat] Convert shapefile to pixel image

2017-06-01 Thread MacQueen, Don
This looks like to would be better to ask on R-sig-geo, instead of R-help. -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 6/1/17, 6:17 AM, "R-help on behalf of lluis.hurt...@uv.es" wrote: Dear all, I am cur

Re: [R] Reversing one dimension of an array, in a generalized case

2017-06-01 Thread Bert Gunter
?? > z <- array(1:24,dim=2:4) > all.equal(f(z,3),f2(z,3)) [1] "Attributes: < Component “dim”: Mean relative difference: 0.444 >" [2] "Mean relative difference: 0.6109091" In fact, > dim(f(z,3)) [1] 2 3 4 > dim(f2(z,3)) [1] 3 4 2 Have I made some sort of stupid error here? Or have I misund

Re: [R] Reversing one dimension of an array, in a generalized case

2017-06-01 Thread David L Carlson
Here is an alternative approach using apply(). Note that with apply() you are reversing rows or columns not indices of rows or columns so apply(junk, 2, rev) reverses the values in each column not the column indices. We actually need to use rev() on everything but the index we are interested in

Re: [R] Reversing one dimension of an array, in a generalized case

2017-06-01 Thread Jeff Newmiller
Not sure it is "obvious", but this function implements what you describe: revdim <- function( a, d ) { dims <- attr( a, "dim" ) idxs <- lapply( seq_along( dims ) , function( dd ) { if ( d == dd ) seq.int( dims[ dd ], 1, -1 ) else se

Re: [R] Problem of a function I wrote

2017-06-01 Thread b88207001
Hello everyone, I know where is wrong. I forget to specify the parameters in my function. Thank you for anyone who was trying to help me! Best, Yen 引述 b88207...@ntu.edu.tw: Hello everyone, It seems that I was not successfully attached the code. Here is the code. I appreciate any help!

Re: [R] Problem of a function I wrote

2017-06-01 Thread b88207001
Hello everyone, It seems that I was not successfully attached the code. Here is the code. I appreciate any help! Best, Yen 引述 b88207...@ntu.edu.tw: Hello everyone, I have been working on a code which simply repeatedly appends a number into a vector and write a file. However, it could no

[R] Problem of a function I wrote

2017-06-01 Thread b88207001
Hello everyone, I have been working on a code which simply repeatedly appends a number into a vector and write a file. However, it could not be properly implemented when I use it. It works when I run it line by line. I wonder what is the problem and I appreciate anyone who is willing to h

Re: [R] Reversing one dimension of an array, in a generalized case

2017-06-01 Thread Roy Mendelssohn - NOAA Federal
Thank you very much. I have a little test example I have been working with, and it does seem to work.I will have to go through and parse this to understand what you are doing What I had been doing is building up a string with the arguments and calling it, it works but very kludgy and ver

Re: [R] Reversing one dimension of an array, in a generalized case

2017-06-01 Thread Bert Gunter
How about this: f <- function(a,wh){ ## a is the array; wh is the index to be reversed l<- lapply(dim(a),seq_len) l[[wh]]<- rev(l[[wh]]) do.call(`[`,c(list(a),l)) } ## test z <- array(1:120,dim=2:5) ## I omit the printouts f(z,2) f(z,3) Cheers, Bert Bert Gunter "The trouble with

Re: [R] Data import R: some explanatory variables not showing up correctly in summary

2017-06-01 Thread William Dunlap via R-help
Re-importing the data with read.table's strip.white=TRUE argument may be an easier way to deal with the problem (if the problem is leading or trailing whitespace). Bill Dunlap TIBCO Software wdunlap tibco.com On Thu, Jun 1, 2017 at 9:17 AM, David Winsemius wrote: > > > On Jun 1, 2017, at 8:57 A

Re: [R] Data import R: some explanatory variables not showing up correctly in summary

2017-06-01 Thread Charles C. Berry
On Thu, 1 Jun 2017, Rui Barradas wrote: Hello, In order for us to help we need to know how you've imported your data. What was the file type? What instructions have you used to import it? Did you use base R or a package? Give us a minimal but complete code example that can reproduce your sit

[R] Reversing one dimension of an array, in a generalized case

2017-06-01 Thread Roy Mendelssohn - NOAA Federal
Hi All: I have been looking for an elegant way to do the following, but haven't found it, I have never had a good understanding of any of the "apply" functions. A simplified idea is I have an array, say: junk(5, 10, 3) where (5, 10, 3) give the dimension sizes, and I want to reverse the sec

Re: [R] odfWeave - A loop of the "same" data

2017-06-01 Thread Charles C. Berry
On Thu, 1 Jun 2017, POLWART, Calum (COUNTY DURHAM AND DARLINGTON NHS FOUNDATION TRUST) via R-help wrote: Before I go and do this another way - can I check if anyone has a way of looping through data in odfWeave (or possibly sweave) to do a repeating analysis on subsets of data? For simplicit

Re: [R] Data import R: some explanatory variables not showing up correctly in summary

2017-06-01 Thread David Winsemius
> On Jun 1, 2017, at 8:57 AM, William Dunlap via R-help > wrote: > > Check for leading or trailing spaces in the strings in your data. > dput(dataset) would show them. This function would strip any leading or trailing spaces from a column: trim <- function (s) { s <- as.charac

Re: [R] Data import R: some explanatory variables not showing up correctly in summary

2017-06-01 Thread David L Carlson
It looks like your printouts are based on the R summary() function? The function lists the number of cases in the 5 largest categories when the variable is coded as a FACTOR. David C -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of David L Carlson Sent:

Re: [R] Data import R: some explanatory variables not showing up correctly in summary

2017-06-01 Thread David L Carlson
It looks like your printouts are based on the R summary() function? The function lists the number of cases in the 5 largest categories when the variable is coded as a function. Then it indicates how many other categories are present. This is described on the manual page for function summary().

Re: [R] Data import R: some explanatory variables not showing up correctly in summary

2017-06-01 Thread William Dunlap via R-help
Check for leading or trailing spaces in the strings in your data. dput(dataset) would show them. Bill Dunlap TIBCO Software wdunlap tibco.com On Thu, Jun 1, 2017 at 8:49 AM, Ulrik Stervbo wrote: > Hi Tara, > > It seems that you categorise and count for each category. Could it be that > the met

Re: [R] Data import R: some explanatory variables not showing up correctly in summary

2017-06-01 Thread Ulrik Stervbo
Hi Tara, It seems that you categorise and count for each category. Could it be that the method you use puts everything that doesn't match the predefined categories in Other? I'm only guessing because without a minimal reproducible example it's difficult to do anything else. Best wishes Ulrik R

Re: [R] Post for R

2017-06-01 Thread David L Carlson
As Hasan notes, your code is scrambled because you sent your message in html format. This list converts all mail to plain text to make it readable to a wider variety of computers and operating systems around the world. One consequence is that the html code for newline gets ignored. The attached

Re: [R] Data import R: some explanatory variables not showing up correctly in summary

2017-06-01 Thread Rui Barradas
Hello, In order for us to help we need to know how you've imported your data. What was the file type? What instructions have you used to import it? Did you use base R or a package? Give us a minimal but complete code example that can reproduce your situation. Hope this helps, Rui Barradas

Re: [R] installed.packages() does not work properly

2017-06-01 Thread Anil Dabral
Thank you. The patched version worked. Installing R 3.4 patched was little tricky because windows SmartScreen Filter kept blocking. But finally, I got it installed. Regards, Anil Sent from Outlook From: Uwe Ligges Sent: Thursday, Ju

[R] [spatstat] Convert shapefile to pixel image

2017-06-01 Thread Lluis.Hurtado
Dear all, I am currently working with the spatstat package, using windows and pixel images. First: My aim is to transform a shapefile (see attached) into a pixel image. My idea is to start transforming the shapefile into a Spatial Polygon file: x <- readShapeSpatial("21441.shp") y <- as(

[R] Data import R: some explanatory variables not showing up correctly in summary

2017-06-01 Thread Tara Adcock
Hi, I have a question regarding data importing into R. When I import my data into R and review the summary, some of my explanatory variables are being reported as if instead of being one variable, they are two with the same name. See below for an example; Behav person Behav dog

[R] [spatstat] Convert shapefile to pixel image

2017-06-01 Thread Lluis.Hurtado
Dear all, I am currently working with the spatstat package, using windows and pixel images. First: My aim is to transform a shapefile (see attached) into a pixel image. My idea is to start transforming the shapefile into a Spatial Polygon file: x <- readShapeSpatial("21441.shp") y <- as(

Re: [R] [FORGED] Re: Question on function "scatterplot3d"

2017-06-01 Thread Uwe Ligges
On 01.06.2017 10:03, Rolf Turner wrote: On 01/06/17 19:54, Uwe Ligges wrote: A design flaw, whether the labels are cut depends somewhat on the sizce of the device, hence there is the argument y.margin.add add additional space between tick mark labels and axis label of the y axis for work

Re: [R] Latin Hypercube Sampling when parameters are defined according to specific probability distributions

2017-06-01 Thread Bert Gunter
I think you should take this conversation private or seek local statistical expertise. This is about strategies for analysis, not about programming in R. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Be

Re: [R] odfWeave - A loop of the "same" data

2017-06-01 Thread Jeff Newmiller
I do this regularly with knitr [1]. I have never used odfWeave, but would imagine that similar principles apply. If you make a child document that assumes that the desired data are stored in one or more objects, then you can use a for loop in the master document that repeatedly extracts the de

[R] odfWeave - A loop of the "same" data

2017-06-01 Thread POLWART, Calum (COUNTY DURHAM AND DARLINGTON NHS FOUNDATION TRUST) via R-help
Before I go and do this another way - can I check if anyone has a way of looping through data in odfWeave (or possibly sweave) to do a repeating analysis on subsets of data? For simplicity lets use mtcars dataset in R to explain. Dataset looks like this: > mtcars mpg cyl disp

Re: [R] (Somewhat?) Off topic: Containerization software

2017-06-01 Thread Suzen, Mehmet
This is a nice summary addressing the same with R: https://arxiv.org/pdf/1410.0846.pdf On 30 May 2017 at 17:43, Bert Gunter wrote: > Folks: > > This is **off topic**, but I thought it might be informative to this > community. Consequently: please **no on list public comments or > discussion**. Fe

Re: [R] [FORGED] Re: Question on function "scatterplot3d"

2017-06-01 Thread Rolf Turner
On 01/06/17 19:54, Uwe Ligges wrote: A design flaw, whether the labels are cut depends somewhat on the sizce of the device, hence there is the argument y.margin.add add additional space between tick mark labels and axis label of the y axis for working around that limittation that can be set t

Re: [R] installed.packages() does not work properly

2017-06-01 Thread Uwe Ligges
Try R-3.4.0 patched. Best, Uwe Ligges On 01.06.2017 03:54, Anil Dabral wrote: Hi, I tried executing the following statement multiple times on R 3.4 and it worked only the first time. In older versions of R it seems to have worked. Am I doing anything wrong? In R 3.4 (works only the first

Re: [R] [FORGED] Re: Question on function "scatterplot3d"

2017-06-01 Thread Uwe Ligges
A design flaw, whether the labels are cut depends somewhat on the sizce of the device, hence there is the argument y.margin.add add additional space between tick mark labels and axis label of the y axis for working around that limittation that can be set to some positive value Best,

Re: [R] Post for R

2017-06-01 Thread Jim Lemon
Hi Carrie, You may have a problem with this if some subsets are empty: L3<-lapply(split(df,cut(df$max,seq(0,1,by=0.01))), split,cut(df$submax,seq(0,0.2,by=0.02))) Jim On Thu, Jun 1, 2017 at 12:48 PM, carrie wang via R-help wrote: > > Hello, > I want to split the dataframe into 1000 groups base