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

[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

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

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

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

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

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

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

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) }

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

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

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

Re: [R-es] errores con openair

2017-06-01 Thread Carlos Ortega
Mira lo que aparece en el conjunto de ejemplo que trae el paquete ("mydata")... Note openair functions generally require data frames with a field "date" that can be in either POSIXct or Date format but should be GMT time zone. This can be hourly data or higher resolution data. Saludos, Carlos

Re: [R-es] errores con openair (Javier Valdes Cantallopts (DGA))

2017-06-01 Thread Javier Valdes Cantallopts (DGA)
OK¡¡ SOLUCIONADO Lo volví a intentar cambiando FECHA A "date" y funcionó -Mensaje original- De: Novvier Marco Uscuchagua Cornelio [mailto:novv...@hotmail.com] Enviado el: jueves, 01 de junio de 2017 16:03 Para: r-help-es@r-project.org CC: Javier Valdes Cantallopts (DGA) Asunto:

Re: [R-es] errores con openair (Javier Valdes Cantallopts (DGA))

2017-06-01 Thread Javier Valdes Cantallopts (DGA)
Hola. Ya lo intenté pero no funcionó cambiando a "date". Quizás el tema vaya por no usar LUBRIDATE y cambiarte a Strptime..Sería una lástima ya que lubridate es una muy buena herramienta y fácil de aplicar. -Mensaje original- De: Novvier Marco Uscuchagua Cornelio

[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,

Re: [R-es] errores con openair

2017-06-01 Thread Carlos Ortega
Hola, El paquete "openair" tiene una pequeña trampa y es el nombre de las variables. Si no recuerdo mal, tienes que llamar a la columna de la fecha de una forma especial ("date"). Mira el ejemplo que viene incluido en el propio paquete y respeta el mismo nombre, superado esto, no hay problema.

Re: [R-es] errores con openair

2017-06-01 Thread Javier Marcuzzi
Estimado Javier Valdes Cantallopts Yo no utilizo libridate, luego de tener muchos inconvenientes con las fechas encontré una forma que dejo de darme dolores de cabeza, básicamente utilizo strptime. https://stat.ethz.ch/R-manual/R-devel/library/base/html/strptime.html Es algo más de código

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-es] errores con openair

2017-06-01 Thread Javier Valdes Cantallopts (DGA)
Al parecer está bien el formato, lo trabajé con lubridate.. > str(TOTAL$fecha) POSIXct[1:131478], format: "2014-01-24 04:10:00" "2014-01-24 04:20:00" "2014-01-24 04:30:00" . [Descripción: FIRMA3] De: gilbello...@gmail.com [mailto:gilbello...@gmail.com] En nombre de Carlos J. Gil Bellosta

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

Re: [R-es] errores con openair

2017-06-01 Thread Carlos J. Gil Bellosta
Revisa el formato de tus fechas. El 1 de junio de 2017, 21:46, Javier Valdes Cantallopts (DGA) < javier.val...@mop.gov.cl> escribió: > Estimados como les va. > > > > He tratado de profundizar sobre el paquete OPENAIR PARA MANEJO DE DATOS. > Sin embargo, cada cosa que intento hacer, por muy

[R-es] errores con openair

2017-06-01 Thread Javier Valdes Cantallopts (DGA)
Estimados como les va. He tratado de profundizar sobre el paquete OPENAIR PARA MANEJO DE DATOS. Sin embargo, cada cosa que intento hacer, por muy pequeña que sea, me tira este error. En definitiva, no he podido hacer absolutamente nada¡¡ He probado de todo, pero ya me estoy aburriendo, a pesar

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

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

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"

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

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

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

[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

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

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: > > >

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

[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

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

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)

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

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.

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

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

[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 <-

[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 <-

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

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

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

[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

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

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

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

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

Re: [R] Post for R

2017-06-01 Thread Hasan Diwan
Carrie, I would suggest a few things before posting your code here: - Put a dput(df) - Format it properly, as it stands it won't compile, because you're missing newlines/semicolons between, e.g. Z <- list()*; *G <- list(); for (i in length(L1)){ Z=data.frame(L1[i])*;* G <-