[R] Plotting function image

ilai keren at math.montana.edu
Wed Feb 15 18:35:01 CET 2012


Inline

On Wed, Feb 15, 2012 at 3:04 AM, uday <uday_143_4u at hotmail.com> wrote:
> Hi ,
>
> Thanks for reply
>
> My latitude and longitude contains 90000-100000 observations per file
> when I run coords <- expand.grid(lat=1:5,long=1:5) then my computer
>
You don't have to run this part. As your original post did not provide
any details on data, coords is only a toy example.


> *** caught segfault ***
> address 0x6951c20, cause 'memory not mapped'
>
> Traceback:
> 1: .C("spline_eval", z$method, nu = as.integer(n), x =
> as.double(xout),     y = double(n), z$n, z$x, z$y, z$b, z$c, z$d, PACKAGE =
> "stats")
> 2: spline(gam.data$x[, col.data], gam.smooths.all$fit[, m], xout =
> gam.results.global[m,     , "x.values"], ties = mean)
>  3: eval.with.vis(expr, envir, enclos)
>  4: eval.with.vis(ei, envir)
> 5: source(file.path(getwd(), "Skripte", "r",
> "GAM_hourly", "1_calcs_GAM_all_sites_hourly.R"),     echo =
> TRUE, max.deparse.length = 2e+05)
>
> Possible actions:
> 1: abort (with core dump, if enabled)
> 2: normal R exit
> 3: exit R without saving workspace
> 4: exit R saving workspace
>

I doubt expand.grid was the cause of this crash, and I see no
reference to it in traceback.

> so is there any other way to deal with this ?
> My main objective to plot this observations on global map
> the sample data is
> lat <- -11.3082 -11.6041 -11.9002 -12.1961 -12.1461 -12.7881 -12.6657
> -12.8467 -13.7233 -13.6271
> lon<- 135.6423 135.5799 135.5184 135.4558 133.5313 135.3321 134.6688
> 133.9839 132.0651 131.5528
> gas <- 1688.91 1679.24 1677.77 1635.60 1652.77 1663.43 1642.16 1671.84
> 1674.65 1665.54
>

Your lat,long do not seem to be forming a uniform grid. ?image would
probably spit an error about "increasing x and y" or something similar
(no access to R on this machine).
You could try
library(lattice)
levelplot(gas~lat+long,data=yourdata)    # data argument is optional
-only if lat,long,gas are columns of a data frame

You may also want to look at the maps package for projections of lat/long

Hope this helps

> --
> View this message in context: http://r.789695.n4.nabble.com/Plotting-function-image-tp4387796p4389959.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list