Re: [R] fields package question
Actually, let's set it grid_new.l <- list(abcissa=c(-15.0,-14.5),ordinate=y) to avoid out of bounds On Tue, Dec 25, 2018 at 4:41 PM M P wrote: > Thanks, Eric, for looking into that. > The values are below and since I subset the new abcissa is smaller range > grid_new.l <- list(abcissa=c(-15.0,-14.),ordinate=y) > I am emailing form gmail - don't know why is using html to format when all > is in ascii > > x > [1] -15.20180 -15.01948 -14.86533 -14.73180 -14.61402 -14.50866 -14.41335 > [8] -14.32634 -14.24629 -14.17219 > y > [1] 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 > z > [5,] 0.6467642 0.6467642 0.6467642 0.6467642 0.6467642 0.6467642 0.6467642 > [6,] 0.5597143 0.5597143 0.5597143 0.5597143 0.5597143 0.5597143 0.5597143 > [7,] 0.4854133 0.4854133 0.4854133 0.4854133 0.4854133 0.4854133 0.4854133 > [8,] 0.4278326 0.4278326 0.4278326 0.4278326 0.4278326 0.4278326 0.4278326 > [9,] 0.3834149 0.3834149 0.3834149 0.3834149 0.3834149 0.3834149 0.3834149 > [10,] 0.3433031 0.3433031 0.3433031 0.3433031 0.3433031 0.3433031 0.3433031 >[,8] [,9] [,10] > [1,] 1.1900951 1.1900951 1.1900951 > [2,] 1.0636935 1.0636935 1.0636935 > [3,] 0.8927228 0.8927228 0.8927228 > [4,] 0.7554456 0.7554456 0.7554456 > [5,] 0.6467642 0.6467642 0.6467642 > [6,] 0.5597143 0.5597143 0.5597143 > [7,] 0.4854133 0.4854133 0.4854133 > [8,] 0.4278326 0.4278326 0.4278326 > [9,] 0.3834149 0.3834149 0.3834149 > [10,] 0.3433031 0.3433031 0.3433031 > > > > On Tue, Dec 25, 2018 at 12:45 AM Eric Berger > wrote: > >> Since you don't provide lambda, rh or qext it is impossible to reproduce >> what you are seeing. >> Also note that in this mailing list HTML formatted emails are not passed >> along. >> >> >> >> On Tue, Dec 25, 2018 at 4:13 AM M P wrote: >> >>> Hello, >>> I used commands below to obtain a surface, can plot it and all looks as >>> expected. >>> How do I evaluate values at new point. I tried as below but that produces >>> errors. >>> Thanks for suggestions/help. >>> >>> x <- log(lambda) >>> y <- rh >>> z <- qext[,,2] >>> >>> grid.l <- list(abcissa=x,ordinate=y) >>> xg <- make.surface.grid(grid.l) >>> out.p <- as.surface(xg,z) >>> plot.surface(out.p,type="p") >>> >>> tried: >>> grid_new.l <- list(abcissa=c(-15.0,-10.),ordinate=y) >>> xg_new <- make.surface.grid(grid_new.l) >>> >>> out_new.p <- predict.surface(out.p,xg_new) >>> >>> results in this prompt: >>> predict.surface is now the function predictSurface> >>> >>> [[alternative HTML version deleted]] >>> >>> __ >>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >>> https://stat.ethz.ch/mailman/listinfo/r-help >>> PLEASE do read the posting guide >>> http://www.R-project.org/posting-guide.html >>> and provide commented, minimal, self-contained, reproducible code. >>> >> [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] fields package question
Thanks, Eric, for looking into that. The values are below and since I subset the new abcissa is smaller range grid_new.l <- list(abcissa=c(-15.0,-14.),ordinate=y) I am emailing form gmail - don't know why is using html to format when all is in ascii x [1] -15.20180 -15.01948 -14.86533 -14.73180 -14.61402 -14.50866 -14.41335 [8] -14.32634 -14.24629 -14.17219 y [1] 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 z [5,] 0.6467642 0.6467642 0.6467642 0.6467642 0.6467642 0.6467642 0.6467642 [6,] 0.5597143 0.5597143 0.5597143 0.5597143 0.5597143 0.5597143 0.5597143 [7,] 0.4854133 0.4854133 0.4854133 0.4854133 0.4854133 0.4854133 0.4854133 [8,] 0.4278326 0.4278326 0.4278326 0.4278326 0.4278326 0.4278326 0.4278326 [9,] 0.3834149 0.3834149 0.3834149 0.3834149 0.3834149 0.3834149 0.3834149 [10,] 0.3433031 0.3433031 0.3433031 0.3433031 0.3433031 0.3433031 0.3433031 [,8] [,9] [,10] [1,] 1.1900951 1.1900951 1.1900951 [2,] 1.0636935 1.0636935 1.0636935 [3,] 0.8927228 0.8927228 0.8927228 [4,] 0.7554456 0.7554456 0.7554456 [5,] 0.6467642 0.6467642 0.6467642 [6,] 0.5597143 0.5597143 0.5597143 [7,] 0.4854133 0.4854133 0.4854133 [8,] 0.4278326 0.4278326 0.4278326 [9,] 0.3834149 0.3834149 0.3834149 [10,] 0.3433031 0.3433031 0.3433031 On Tue, Dec 25, 2018 at 12:45 AM Eric Berger wrote: > Since you don't provide lambda, rh or qext it is impossible to reproduce > what you are seeing. > Also note that in this mailing list HTML formatted emails are not passed > along. > > > > On Tue, Dec 25, 2018 at 4:13 AM M P wrote: > >> Hello, >> I used commands below to obtain a surface, can plot it and all looks as >> expected. >> How do I evaluate values at new point. I tried as below but that produces >> errors. >> Thanks for suggestions/help. >> >> x <- log(lambda) >> y <- rh >> z <- qext[,,2] >> >> grid.l <- list(abcissa=x,ordinate=y) >> xg <- make.surface.grid(grid.l) >> out.p <- as.surface(xg,z) >> plot.surface(out.p,type="p") >> >> tried: >> grid_new.l <- list(abcissa=c(-15.0,-10.),ordinate=y) >> xg_new <- make.surface.grid(grid_new.l) >> >> out_new.p <- predict.surface(out.p,xg_new) >> >> results in this prompt: >> predict.surface is now the function predictSurface> >> >> [[alternative HTML version deleted]] >> >> __ >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> > [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] fields package question
Hello, I used commands below to obtain a surface, can plot it and all looks as expected. How do I evaluate values at new point. I tried as below but that produces errors. Thanks for suggestions/help. x <- log(lambda) y <- rh z <- qext[,,2] grid.l <- list(abcissa=x,ordinate=y) xg <- make.surface.grid(grid.l) out.p <- as.surface(xg,z) plot.surface(out.p,type="p") tried: grid_new.l <- list(abcissa=c(-15.0,-10.),ordinate=y) xg_new <- make.surface.grid(grid_new.l) out_new.p <- predict.surface(out.p,xg_new) results in this prompt: predict.surface is now the function predictSurface> [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] an apply question
Hello, It should be easu but I cannot figure out how to use apply function. I am trying to replace negative values in an array with these values + 24. Would appreciate help. Thanks, Mark shours - apply(fhours, function(x){if (x 0) x - x+24}) Error in match.fun(FUN) : argument FUN is missing, with no default [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] subsetting time series
Hello, my series of dates look like [1] 2012-05-30 18:30:00 UTC 2012-05-30 19:30:00 UTC [3] 2012-05-30 20:30:00 UTC 2012-05-30 21:30:00 UTC [5] 2012-05-30 22:30:00 UTC 2012-05-30 23:30:00 UTC [7] 2012-05-31 00:30:00 UTC 2012-05-31 01:30:00 UTC [9] 2012-05-31 02:30:00 UTC 2012-05-31 00:30:00 UTC [11] 2012-05-31 01:30:00 UTC 2012-05-31 02:30:00 UTC [13] 2012-05-31 03:30:00 UTC 2012-05-31 04:30:00 UTC [15] 2012-05-31 05:30:00 UTC 2012-05-31 06:30:00 UTC [17] 2012-05-31 07:30:00 UTC 2012-05-31 08:30:00 UTC [19] 2012-05-31 06:30:00 UTC 2012-05-31 07:30:00 UTC ... I'd like to subset this to four series 1) [1] 2012-05-30 18:30:00 UTC 2012-05-30 19:30:00 UTC [3] 2012-05-30 20:30:00 UTC 2012-05-30 21:30:00 UTC [5] 2012-05-30 22:30:00 UTC 2012-05-30 23:30:00 UTC [7] 2012-05-31 00:30:00 UTC 2012-05-31 01:30:00 UTC [9] 2012-05-31 02:30:00 UTC [10] 2012-05-31 18:30:00 UTC 2012-05-31 19:30:00 UTC ... 2) 2012-05-31 00:30:00 UTC - [1] [11] 2012-05-31 01:30:00 UTC 2012-05-31 02:30:00 UTC - [2,3] [13] 2012-05-31 03:30:00 UTC 2012-05-31 04:30:00 UTC [15] 2012-05-31 05:30:00 UTC 2012-05-31 06:30:00 UTC [17] 2012-05-31 07:30:00 UTC 2012-05-31 08:30:00 UTC [10] 2012-06-01 00:30:00 UTC 3) [19] 2012-05-31 06:30:00 UTC 2012-05-31 07:30:00 UTC ... so that I can plot data for each of the series separately without e.g. data at hour 2012-05-31 02:30:00 UTC connecting in the figure to 2012-05-31 00:30:00 UTC Basically, cycling through the series with period 9 Thanks for any suggestions/help, thanks, Mark [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] subsetting time series
Thats works perfectly, thanks a lot, Mark On Thu, Dec 13, 2012 at 11:34 AM, arun smartpink...@yahoo.com wrote: Hi, Try this: seq1-seq(from=as.POSIXct(2012-05-30 18:30:00,tz=UTC),to=as.POSIXct(2012-05-31 02:30:00,tz=UTC),by=1 hour) seq2-seq(from=as.POSIXct(2012-05-31 00:30:00,tz=UTC),to=as.POSIXct(2012-05-31 08:30:00,tz=UTC),by=1 hour) seq3-seq(from=as.POSIXct(2012-05-31 06:30:00,tz=UTC),to=as.POSIXct(2012-05-31 07:30:00,tz=UTC),by=1 hour) Sys.setenv(TZ=UTC) Series1-c(seq1,seq2,seq3) split(Series1,rep(1:3,each=9)) #or individually if it is a small dataset Series1[1:9] Series1[10:18] etc. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] ncdf - writing variable to a file
Hello, I have a problem writing a variable to an existing file. Below is a part of my script and how it fails. I can't find create.var.ncdf in help Thanks for any help. Mark nc - open.ncdf(ncname, readunlim=FALSE, write=TRUE ) missing - 1.e+30 xdim - nc$dim[[west_east]] ydim - nc$dim[[south_north]] tdim - nc$dim[[Time]] lscalevar - var.def.ncdf(scalenames[ivar], 'gpoints', list(xdim,ydim,tdim), missing ) nc - var.add.ncdf( nc, lscalevar ) for( i in 1:nt) put.var.ncdf(nc,lscalevar,scale,verbose=TRUE ) #scale is an array dimensioned (nx,ny) [1] Hint: make SURE the variable was not only defined with a call to def.var.ncdf, but also included in the list passed to create.var.ncdf Error in vobjtovarid(nc, varid, verbose = verbose) : stopping In addition: Warning message: In is.na(vals) : is.na() applied to non-(list or vector) of type 'closure' [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] variable spatial correlation
Hello, I used correlogram from spatial package to determine correlation scale for my data but just looking with bare eye it seems that the correlation scale varies over the domain. Can someone suggest what would the best way to handle that problem? Thanks, Mark [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] 1-d function fitting
Hello, I'd like to check if my data can be well approximated with a function (1+x/L) exp(-x/L) and calculate the best value for L. Is there some package in R that would simplify that task? Thanks, Mark __ [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.