Re: [R] Labeling world map

2015-07-25 Thread Ray Brownrigg
o state") nat <-geocode(native) nat.x <- nat$lon nat.y <- nat$lat points(nat.x,nat.y,col="yellow",pch=16) How can i put lilte for this map and label points title("This is a title") text(nat.x, nat.y, c("A", "B"), col=2) If this isn't what y

Re: [R] Plotting boundary lines from shapefiles overtop a map of Canada

2014-09-23 Thread Ray Brownrigg
p() with a projection because the most recent projection (and its parameters) are "remembered". Also I suspect (though untested) is that if you put NA pairs in between your lists of projected SAR regions, then you can just use lines() to draw them all at once. Hope this helps, Ray

Re: [R] Plotting boundary lines from shapefiles overtop a map of Canada

2014-09-24 Thread Ray Brownrigg
me know what I'm doing wrong because I can't see it. By the way, not specifying the lambert projection in the call to mapproject yields different results than specifying it which seems contrary to the documentation (?). Thanks Alain Dubreuil Ottawa, Canada -Original Message-

Re: [R] Plotting boundary lines from shapefiles overtop a map of Canada

2014-09-24 Thread Ray Brownrigg
25 degrees W). Is there a way to show just the map of Canada (without the USA) while still showing the desired width? I assumed that it was constraining the width because of the "Canada" specification in the map command, so I removed it but it ended up showing the entire USA

Re: [R] Reading in a value of .Random.seed in .Rprofile

2008-08-20 Thread Ray Brownrigg
Hi Rolf: I think this is a case of RTFM. ?.Rprofile tells you that the profile is executed before the workspace is restored. Initially I thought this might be similar to bug PR#12567 that I filed this week, but now I think not necessarily. Cheers, Ray On Thu, 21 Aug 2008, Rolf Turner wrote

Re: [R] sequence with start and stop positions

2008-08-26 Thread Ray Brownrigg
And somewhat faster still (YMMV): unlist(mapply(":", start, stop)) HTH, Ray Brownrigg Victoria University of Wellington Christos Hatzis wrote: Try: unlist(mapply(seq, c(1,20,50), c(7,25,53))) [1] 1 2 3 4 5 6 7 20 21 22 23 24 25 50 51 52 53 -Christos -Origin

Re: [R] projections

2010-02-15 Thread Ray Brownrigg
If you use map() with the projection= option, then see ?mapproject, which allows you to project arbitrary (long/lat) points with the previously defined projection. Then you use points() to overlay them onto the map. HTH, Ray Brownrigg On Tue, 16 Feb 2010, Shaun Langley wrote: > I have

Re: [R] R Graphics into Latex‏

2010-02-24 Thread Ray Brownrigg
On Thu, 25 Feb 2010, Lars Bishop wrote: > Hi, > > I'm new in Latex and I'm trying to include an R chart into a Latex > document. > > This is what I'm doing: > > 1) In R: save the chart as a a Postcript in a folder C:/xxx/Density.eps > > 2) In Latex (using TexWorks on windows xp) : > > In the preamb

Re: [R] Mainland "Equatorial Guinea" missing?

2010-03-01 Thread Ray Brownrigg
On Tue, 02 Mar 2010, Duncan Murdoch wrote: > On 01/03/2010 10:31 AM, more wrote: > > In the World map, mainland "Equatorial Guinea" seems to be missing > > although two offshore parts, "Equatorial Guinea:Annobon" and "Equatorial > > Guinea:Fernando Po", are present. I'd like to be able to fill

Re: [R] Help running a Fortran subroutine from R

2010-03-16 Thread Ray Brownrigg
On Wed, 17 Mar 2010, dc896148 wrote: > The output will be an array of the same dimension as 'array', the first > argument passed to the subroutine. The output array is the second > argument, 'array1', which will be populated with the smoothed values > according to the subroutine. > I can run the s

Re: [R] Find a rectangle of maximal area

2010-03-22 Thread Ray Brownrigg
nd) loops over all 'feasible' pairs of x values, then selects the largest rectangle for each pair, subject to your specified constraints. I have no idea if it implements a previously published algorithm. Other constraints are reasonably easily accommodated. HTH, Ray Brownrigg > T

Re: [R] Find a rectangle of maximal area

2010-03-22 Thread Ray Brownrigg
Sorry, minor tweak to the algorithm in line 16 (thanks Barry). Looks better now (at end again). Ray On Tue, 23 Mar 2010, Ray Brownrigg wrote: > On Tue, 23 Mar 2010, Hans W Borchers wrote: > > Barry Rowlingson lancaster.ac.uk> writes: > > > On Mon, Mar 22, 2010 at 4:2

Re: [R] Find a rectangle of maximal area

2010-03-22 Thread Ray Brownrigg
On Tue, 23 Mar 2010, Jim Lemon wrote: > On 03/23/2010 10:23 AM, Ray Brownrigg wrote: > > ... > > > > How about less than 2 seconds? [And 500 points in less than 15 seconds - > > on a 2-year-old DELL Optiplex GX755.] > > > > The implementation below (at en

Re: [R] filled.contour ON TOP of a base map

2010-04-15 Thread Ray Brownrigg
may have to do things the 'hard way': set up two regions, draw a map in the first, (here you can then use polygon to colour the ocean green, then overlay the map again), overlay your filled contour (perhaps again using polygon), then set up the legend in the other region. Hope this

Re: [R] Maps: Country coding

2010-04-27 Thread Ray Brownrigg
he map function. > > Thanks, > Berthold If you mean the names of the countries, have a look at the file: ${R_HOME}/library/maps/mapdata/world.N which lists the name associated with every polygon. Note that the maps database is historical, for example Czechos

Re: [R] for loop

2009-09-28 Thread Ray Brownrigg
9 How about: rbinom((KM1 + 1)*60, dat$nvac, dat$p.trt[rep(0:KM1, each=60) + 1:60]) HTH Ray Brownrigg __ 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-gu

Re: [R] Problem Removing Border Lines in Maps Package

2009-10-24 Thread Ray Brownrigg
Have a look at: map("county", fill=TRUE , col=palette() , resolution=0, lty=0) HTH, Ray Brownrigg Anthony Damico wrote: I'm working with the nationwide county maps data, and trying to remove the internal county boundary lines. The only map() function parameter that I'v

Re: [R] plot filled.contour over continent map

2009-11-19 Thread Ray Brownrigg
try adding the map using: map('worldHires',xlim=c(-10,40),ylim=c(35,70),boundary = TRUE, border=0.1, add = TRUE) You may have to put the xlim= and ylim= into the filled.contour() call to get what you want. HTH Ray Brownrigg > Anybody could help me out here? > Thanks in advance,

Re: [R] plot filled.contour over continent map

2009-11-23 Thread Ray Brownrigg
map('worldHires', xlim = c(-5, 40), ylim = c(35, 70), add = T, col = "darkgrey")} ) Ray Brownrigg On Fri, 20 Nov 2009, Matthias Demuzere wrote: > Dear all, > > As a newbie in R I would like to do the following (simple?) thing: > > to plot a filled.contour plot over a

Re: [R] plotting a grid with color on a map

2009-05-13 Thread Ray Brownrigg
)/5, (lon + 185)/5] if (!is.na(col)) polygon(lat + xvals, lon + yvals, col=col, border=NA) } palette("default") HTH Ray Brownrigg __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting

Re: [R] map of china without regions

2009-04-16 Thread Ray Brownrigg
uggest the best) are more likely to be able to provide what you want without so much effort. HTH Ray Brownrigg On Fri, 17 Apr 2009, Cuvelier Etienne wrote: > Hello, > I use the map package in conjunction with the mapdata package, > and I want to draw the map of China without interior reg

Re: [R] ggplot2: ... seem to be overwriting each other

2010-01-31 Thread Ray Brownrigg
While I have never used ggplot2, it looks to me like the minimal reproducible code that replicates your "problem" is: plot <- 1 plot + 2 plot + 3 HTH Ray Brownrigg On Mon, 01 Feb 2010, Eric Fail wrote: > Dear list > > A week ago Dennis Murphy helped me out by showin

Re: [R] Calculate geographic/euclidian distance between consecutive XY-pairs

2012-12-18 Thread Ray Brownrigg
s a result? Or can anyone give an example? How about something like: coords <- data.frame(X=c(100,102,104,102,103),Y=c(12,14,14,13,16),Time=c(1,2,3,4,5)) with(coords, sqrt(diff(X)^2 + diff(Y)^2)) Ray Brownrigg best regards, /j __ R-help@r-projec

Re: [R] R maps Help

2013-02-09 Thread Ray Brownrigg
like: x11(width=30, height=18) map_world() Otherwise, you will need to describe exactly what you mean by "really too small to show the data effectively" and provide a reproducible example. Ray Brownrigg On 10/02/2013 5:06 a.m., Frank Rodgers wrote: I am fairly new to R and am

Re: [R] No Ukraine in maps library?

2013-05-06 Thread Ray Brownrigg
re readily available data formats such as shapefiles.. See the CRAN Spatial task view. Ray Brownrigg On 6/05/2013 7:10 p.m., Hamid Bazzaz wrote: Hello folks, I am trying to use maps library to visualize a metric over the world map. But I notice that the world map is rather stale. For instance, I don

Re: [R] Unable to load a file: no such file or directory

2014-05-25 Thread Ray Brownrigg
nt to open a file: DATOS1 <- matrix(scan(file.choose()), ncol = 8) > The unit E: is an external hard disk. > It seems like the path were wrong. > I´ve read the FAQ´s, the Windows FAQ´s, the R document about scan() function > and the related sections of An Intr

Re: [R] Map plotting in a box

2014-02-28 Thread Ray Brownrigg
I can't comment further than saying that: library(mapdata) map("worldHires","Ireland") box() seems to me to do what you want, so are you using a different version of box()? If it is not what you want. you need to be more explicit. Ray Brownrigg

Re: [R] points with-in boundaries of a map

2014-03-24 Thread Ray Brownrigg
and", exact = TRUE, as.polygon = > TRUE) Note it is not necessary to use the unexported map.poly() since fill=TRUE achieves the same thing: ie.polygon <- map("world", "Ireland", exact = TRUE, fill = TRUE, plot = FALSE) Ray Brownrigg maps maintainer __

Re: [R] R optimization and curve()?

2010-10-12 Thread Ray Brownrigg
On Wed, 13 Oct 2010, jcress410 wrote: > u <- function(x) { >     x1 <- x[1] >     x2 <- x[2] >  (x1^alpha)*(x2^(1-alpha)) > } > utility <- function(x) x[1]^(alpha)*x[2]^(1-alpha) > p <- c(2,1) > i <- -100 > alpha <- .3 > umax <- function(p,i,u) { > res <- constrOptim(c(.5,.5), u, grad=NULL, ui=-p,

Re: [R] Computing Rolling Average

2010-11-16 Thread Ray Brownrigg
as in your result[1, 2], unless you have mis-stated the question. Anyway, try: apply(a, 2, function(x) {cx <- cumsum(x); N <- length(x); (cx[7:N] - c(0, cx[1:(N-7)]))/7} HTH Ray Brownrigg > Paolo __ R-help@r-project.org mailing list https://s

Re: [R] Parameterising apply To Compute Rolling Average of Columns in a matrix

2010-11-17 Thread Ray Brownrigg
> Is there a way to pass an additional parameter to apply? > RTFM. Thats what the ... option of apply() is for. apply(a, 2, RollingAverage, RollingObs=7) Ray > Thanks > > Paolo > > On 16 November 2010 20:05, Ray Brownrigg wrote: > > On Wed, 17 Nov 2010

Re: [R] Color Alaska in USA map

2010-11-20 Thread Ray Brownrigg
Did you try USA:Alaska? That should work. I don't have the latticeExtra package installed so I cannot easily test your code, but map("world", c("USA", "Hawaii"), fill=TRUE) looks OK to me. However you don't actually show the code you are using when

Re: [R] Minor warning about seq

2010-12-01 Thread Ray Brownrigg
I think both responses so far have missed the point, (assuming the O was a typo for zero). That is: > seq(0:1) [1] 1 2 when > seq(0,1) [1] 0 1 was intended. Ray Brownrigg On Wed, 01 Dec 2010, Ista Zahn wrote: > So you are warning us that you must type zero instead of the letter O

Re: [R] Can I create an European map using the map function in R

2010-07-27 Thread Ray Brownrigg
uot;UK:Northern Ireland", since there is no country called "UK". Similarly, Malta is named as "Malta:Malta". Hope this helps, Ray Brownrigg > > Also, I am not very sure about the steps in importing external map data and > use that information to generate a spa

Re: [R] [Rd] R CMD build wiped my computer

2010-07-28 Thread Ray Brownrigg
e I have a local copy of), and the build produced this: : * removing junk files * excluding invalid files from 'RColorBrewer' Subdirectory 'R' contains invalid file names: residuals.MCMCglmm.R xyz : where the space shown between the "R" and the "xyz" was a newline

Re: [R] adding FORTRAN code to a package

2010-08-03 Thread Ray Brownrigg
e: lattice > Loading required package: yaImpute > stl2 1.0 loaded > ** help > *** installing help indices > ** building package indices ... > ** testing if installed package can be loaded > > * DONE (RcmdrPlugin.push) > > c:\R\R-2.11.1\bin> > > But

Re: [R] R CMD check warning

2011-05-05 Thread Ray Brownrigg
to do this.] In general Warnings are just that - they point you to a possible fault, but there is not enough information for the code to make a final determination. HTH Ray Brownrigg __ R-help@r-project.org mailing list https://stat.ethz.ch/mail

Re: [R] Overlaying maps

2011-05-18 Thread Ray Brownrigg
Using my mind-reading skills, plot.Map(), while deprecated, does provide an add= option. If this doesn't help, you'll need to read the posting guide and provide (a lot) more information. Ray Brownrigg On Thu, 19 May 2011, michael.laviole...@dhhs.state.nh.us wrote: > I'm

Re: [R] How to do a moving window on standard deviation

2011-01-30 Thread Ray Brownrigg
s because the value returned from a loop is the last value calculated, not every value calculated. HTH, Ray Brownrigg __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-projec

Re: [R] questions about counting numbers

2011-02-06 Thread Ray Brownrigg
It's not quite clear what the OP really wanted. A more general solution may be: > a=c(4, 3, 2, 3) > ta <- table(a) > ta a 2 3 4 1 2 1 > ta[as.character(a)] a 4 3 2 3 1 2 1 2 > HTH Ray Brownrigg On Mon, 07 Feb 2011, Jorge

Re: [R] use map.axes for a projected map

2011-02-13 Thread Ray Brownrigg
Sybil: Have a look at ?map.grid for a start. You will need to fiddle if you really don't want the grid lines. HTH, Ray Brownrigg On Sun, 13 Feb 2011, sybil wrote: > Hi, > I am new to R and I want to display longitude and latitude for a projected > map. > map.axes won'

Re: [R] World plots and clipping regions

2011-03-27 Thread Ray Brownrigg
Not with the code as it is provided. However with a reasonably easy modification to map.grid() (to return the coordinates of the red dotted line) and a call to polygon(), what you want can be achieved. Let me know if you need further details. Ray Brownrigg On 03/26/11 10:11, Saptarshi Guha

Re: [R] Grid on Map

2011-04-07 Thread Ray Brownrigg
Have a look at ?mapproject When you use a projection with map(), you subsequently have to transform your lat/long coordinates to conform to the projection. HTH Ray Brownrigg On 8/04/2011 6:11 a.m., Jaimin Dave wrote: Hi, I tried it using abline but it is not showing any o/p(i.e no grids are

Re: [R] Find number of elements less than some number: Elegant/fastsolution needed

2011-04-14 Thread Ray Brownrigg
and for f3(): > tt [1] 0.717 0.882 1.010 1.161 1.389 3.080 15.530 I suspect ecdf() is a little more intuitive than findInterval(). Hope this helps, Ray Brownrigg On Fri, 15 Apr 2011, Ravi Varadhan wrote: > Bill's code is insanely fast! > > f2 <- function(x, y

Re: [R] Unreasonable syntax error

2011-06-20 Thread Ray Brownrigg
try the next errors as > there would be too many lines to type...I'm not sure if this is something > about Word > > http://r.789695.n4.nabble.com/file/n3612530/lastsave.txt lastsave.txt > > Thanks a lot for your help!!! > Why use Word for a text file when Notepad would do the

Re: [R] installation of package 'mapproj' had non-zero exit status

2011-07-12 Thread Ray Brownrigg
at line should read: awk -f convert.awk < world.line > world2.line So check that you have awk installed. I can't think what else could cause this. Note the maps package does pass the package check test for Linux x86_64, but only r-patched (not r- release) is recorded on the web site a

Re: [R] low resolution word map

2012-07-30 Thread Ray Brownrigg
On 07/28/12 23:46, Thomas Steiner wrote: > Hi, > I'd like to have a low resolution word map in R. > The "maps" package has this option, but if I use the argument, the map > looses sense: Russia and Australia get empty etc > > library("maps") > m=map(col="skyblue",fill=TRUE,plot=TRUE,resolution=10)

Re: [R] Coloring Counties in a State Map

2012-07-30 Thread Ray Brownrigg
On 07/29/12 08:56, arcata wrote: > I am mapping U.S. state counties in individual states maps, e.g. A map of > Montana, with county lines. > How do I fill specific counties with a different color? > Do you mean something like: m <- map("county", "Montana") map("county", m$names[c(1, 4)], fill=TRU

Re: [R] low resolution word map

2012-08-06 Thread Ray Brownrigg
On 2/08/2012 8:06 a.m., Thomas Steiner wrote: Hi Ray, 2012/7/31 Ray Brownrigg : On 07/28/12 23:46, Thomas Steiner wrote: Hi, I'd like to have a low resolution word map in R. The "maps" package has this option, but if I use the argument, the map looses sense: Russia and Australi

Re: [R] How to overlay a global map on a filled contour?

2012-08-12 Thread Ray Brownrigg
ratio you have set up when you use add=TRUE. Also if you RTFM ?mapproject, you may realise that performing the projection first, then the (projected) filled contour (then overlaying the map again may achieve what you want. Ray Brownrigg > I have found a kluge that works, involving re-setting par(usr)

Re: [R] inset one map on top of another map

2011-09-27 Thread Ray Brownrigg
it can get the aspect ratio right. > > Any suggestions? > How about something like: map("state", region= "ohio", xlim=c(-85, -80), ylim=c(38, 42)) par(usr=c(-216, -66, 24, 144)) # you should be able to 'automate' this calculation map("state&quo

Re: [R] Problem with R CMD check and the inconsolata font business.

2011-11-03 Thread Ray Brownrigg
ges/inconsolata.tpm > > Which seems to confirm that TeX knows and has the font. > > I would appreciate any further assistance. > SNIP Brian: When I first tried an R CMD check (or it was probably an R CMD INSTALL --build) using R-2.14.0 on a Windows system with MiKTeX 2.8,

[R] [R-pkgs] maps package updated databases

2011-11-10 Thread Ray Brownrigg
The latest version, maps_2.2-2 (appearing "soon" on CRAN), has been enhanced with the state.vbm and state.carto databases (thanks to Simon Urbanek), and the state.fips, county.fips (both thanks to Clint Cummins), state.vbm.center and state.carto.center datasets. Enjoy, Ray

Re: [R] plotting border over map

2012-03-18 Thread Ray Brownrigg
On Sat, 17 Mar 2012, uday wrote: > I am using following codes to plot map > > library(sp) > library(rgdal) > library(maps) > library(gplots) > library(clim.pact) > library(fields) > source("/R/PlotGridded2DMap.R") > source("/R/image.plot.fix.R") > source("/R/image.plot.plt.fix.r") > > seasonal_pl

Re: [R] How to make this for() loop memory efficient?

2012-01-10 Thread Ray Brownrigg
mple, > > A[17,1]/A[17,2] > > #and I'll arrive at the mean number of modules per call where the call > starts with a module that starts with 97. > > A[17,1] > #is 10, which means that, out of every single call that started with a > module of 97X,XXX, > #they went th

Re: [R] How to make this for() loop memory efficient?

2012-01-10 Thread Ray Brownrigg
On Wed, 11 Jan 2012, Ray Brownrigg wrote: > On Wed, 11 Jan 2012, iliketurtles wrote: > > ##I have 2 columns of data. The first column is unique "event IDs" that > > represent a phone call made to a customer. > > ###So, if you see 3 entries together in the first colum

Re: [R] How to make this for() loop memory efficient?

2012-01-10 Thread Ray Brownrigg
Steve: I don't understand why you couldn't get the original code working. You just have to notice that one comment overflows its line. However I couldn't get your code to match the output of the original - almost, but not quite! Ray On Wed, 11 Jan 2012, Steve Lianoglou wrote: > I'm having

Re: [R] Coloring counties on a full US map based on a certain criterion

2012-01-13 Thread Ray Brownrigg
don't want to modify the code; use the option resolution=0 in the map() call. I.e. try (in Sarah's original Iowa example): map('county', 'iowa', fill= TRUE, col = classcolors[countycol], resolution=0, lty=0) This ensures that the polygon boundaries match up

Re: [R] Coloring counties on a full US map based on a certain criterion

2012-01-14 Thread Ray Brownrigg
Well, I would hazard a guess that the package maintainer would know :-) The answer to your first question is "As and when the package maintainer is informed of errors or changes". The answer to your second question is "No." Ray On Fri, Jan 13, 2012 at 3:41 PM, Ray Brownrig

Re: [R] Package "maps": what is the name of county # 2395?

2012-01-16 Thread Ray Brownrigg
h. It's a remnant of that county's merge with Jackson County. At the time I didn't care to go through renumbering all the remaining counties. The next version of maps will have this fixed. Ray Brownrigg > This question would seem more appropriate for greater efforts on your

Re: [R] Display numbers on map

2012-01-17 Thread Ray Brownrigg
get the whole lot (which I am willing to bet is not exactly what is wanted, even though it is what was stated). This is not the end of the story, but if you'll state exactly what you want for Alaska and Hawaii, then perhaps we can supply a solution. Ray Brownrigg On Wed, 18 Jan 2012, Da

Re: [R] Alaska and Hawaii map data?

2012-01-19 Thread Ray Brownrigg
kage, so if you need new functionality, you are quite at liberty to add it yourself. Further, there are other mapping (and more general 'spatial') packages available, that may provide such functionality. See the CRAN spatial taskview at: http://cran.r-project.org/w

Re: [R] Alaska and Hawaii map data?

2012-01-23 Thread Ray Brownrigg
s (and most countries). See e.g. http://www.census.gov/geo/www/tiger/tgrshp2010/tgrshp2010.html for a description, then ftp://ftp2.census.gov/geo/pvs/tiger2010st/ to get the county numbers, then ftp://ftp2.census.gov/geo/tiger/TIGER2010/COUNTY/2010/ to download the relevant shapefiles. Hope this

Re: [R] units for mapproject() function result

2012-02-07 Thread Ray Brownrigg
looks like radians to me, with some unspecified origin(depending on the parameters specified). Certainly the maps package data is specified in radians internally. Hope this helps, Ray Brownrigg __ R-help@r-project.org mailing list https://stat.ethz.c

Re: [R] optimization setup

2008-05-29 Thread Ray Brownrigg
, with no default > What I did wrong? I guess I miss something basic... > Thanks in advance, robert > > Ray Brownrigg-2 wrote: > > On Wed, 23 Apr 2008, threshold wrote: > >> Hi, here comes my problem, say I have the following functions (example > >> case) #-

Re: [R] Problem in executing R on server

2008-06-05 Thread Ray Brownrigg
What does the limit (or "ulimit -a" in sh or bash) command (outside of R) respond with? In Solaris, there can be per-user limits to memory use. HTH, Ray Brownrigg On Fri, 06 Jun 2008, Jason Lee wrote: > Hi R-listers, > > I have problem in executing my R on server. It r

Re: [R] Problem in executing R on server

2008-06-05 Thread Ray Brownrigg
unlimited > max user processes (-u) 257579 > virtual memory (kbytes, -v) 30 > file locks (-x) unlimited > > Is that because of Virtual memory? Because the above figure gives only 300 > 000 KB while in my Pc it is Unlimited. > > >

Re: [R] paste data

2008-06-18 Thread Ray Brownrigg
get() is your friend. Try: for (x in 1:length(plot)) { thisdf <- paste("auto.", plot[x], sep="") plot(thisdf[, 1], thisdf[, 2], col=...) } HTH, Ray Brownrigg Sybille Wendel wrote: Hello, I need a command. I have a lot of data in different dataframes(au

Re: [R] flow map lines between point pairs (latitude/longitude)

2008-07-02 Thread Ray Brownrigg
sitTrips[, 1])) { lines(df2VisitTrips[i, c(5, 7)], df2VisitTrips[i, c(4, 6)], lwd=0.2 + df2VisitTrips[i, 3]/10, col=i+1) } Ray Brownrigg On Thu, 03 Jul 2008, Richard and Barbara Males wrote: > I have a dataset giving traffic between pairs of ports, and the > lat/lon of each port, roughly

Re: [R] Lots of huge matrices, for-loops, speed

2008-07-06 Thread Ray Brownrigg
Ray Brownrigg On Mon, 07 Jul 2008, Zarza wrote: > Hello, > we have 80 text files with matrices. Each matrix represents a map (rows for > latitude and columns for longitude), the 80 maps represent steps in time. > In addition, we have a vector x of length 80. We would like to compute a

Re: [R] shading an area in a edf

2008-07-08 Thread Ray Brownrigg
y1 <- c(0, F2.5(rep(x1, each=2)), 0) polygon(x1a, y1, col=2) x2 <- x[x >= mx] x2a <- rep(c(mx, x2), each=2) y2 <- c(1, F2.5(rep(c(x1[length(x1)], x2[-length(x2)]), each=2)), 1) polygon(x2a, y2, col=2) This seems to work even if the mean coincides with one of the x values. HTH Ray

Re: [R] New Zealand Maps

2008-07-15 Thread Ray Brownrigg
Did you find: http://koordinates.com/find/?page=5 ? HTH Ray Brownrigg MSCS Victoria University On Wed, 16 Jul 2008, Tom Love wrote: > Can anyone point me to a map file for New Zealand Territorial Local > Authorities? Apologies if this is obvious, but I'm rather new to > mappi

Re: [R] New Zealand Maps

2008-07-15 Thread Ray Brownrigg
Actually, http://www.stats.govt.nz/statistics-by-area/geography-mapping/download-digital-boundaries.htm is probably better. Ray On Wed, 16 Jul 2008, Tom Love wrote: > Can anyone point me to a map file for New Zealand Territorial Local > Authorities? Apologies if this is obvious, but I'm rather

Re: [R] How to remove double loop?

2008-03-19 Thread Ray Brownrigg
Read the posting guide (the bit about reproducible code): > OVal <- matrix(0, n+1, n+1) > > for(i in 0:n){ + OVal[i+1, n+1] <- max(Val[i+1, n+1]-K, 0) + } Error: object "Val" not found > > for(i in seq(n,1, by=-1)){ + for(j in 0:(i-1)){ + OVal[j+1, i] <- a*((1-p)*OVal[j+1, i+1]+p*O

Re: [R] How to remove double loop?

2008-03-19 Thread Ray Brownrigg
- colSums(matrix(a*c((1 - p), p)* OVal[, i + 1][rep(1:2, i) + rep(0:(i - 1), each=2)], ncol=i)) } list("Stock Price"=Val, "Option Price"=OVal) } Here the first loop is removed with a simple pmax() (the 'vector' form of max()). The second loop uses the trick

Re: [R] optimization setup

2008-04-22 Thread Ray Brownrigg
On Wed, 23 Apr 2008, threshold wrote: > Hi, here comes my problem, say I have the following functions (example > case) # > function1 <- function (x, theta) > {a <- theta[1] ( 1 - exp(-theta[2]) ) * theta[3] ) > b <- x * theta[1] / theta[3

Re: [R] Applying user function over a large matrix

2008-04-29 Thread Ray Brownrigg
r system elapsed 7.825 0.011 7.840 > unix.time(apply(x, 2, sum)) user system elapsed 15.431 0.142 15.592 > Also, preliminary checking using the top utility shows the for loop requires just over half the memory of the apply() call. This is on a NetBSD system with 2GB memory.

Re: [R] Why R is 200 times slower than Matlab ?

2008-04-30 Thread Ray Brownrigg
ep(input_fc, each=n), rep(input_fc, n)), 2, n*n, byrow = T)}) user system elapsed 0.019 0.020 0.040 > all.equal(a1, a2) [1] TRUE > A sample of length 300 took less than 1 second using your grw_permute() (so your OS may be making a difference as well). > > Am

Re: [R] Why R is 200 times slower than Matlab ?

2008-04-30 Thread Ray Brownrigg
t; function[fc_matrix]=grw_permute(fc_vector) > > > > n=length(fc_vector); > > > > fc_matrix=zeros(2,n^2); > > > > index=1; > > for i=1:n > > for j=1:n > > fc_matrix(index)=fc_vector(i); > > fc_matrix(index+1)=fc_vector(j); > >

Re: [R] map - mapproj : problem of states localisation

2007-11-15 Thread Ray Brownrigg
On Fri, 16 Nov 2007, Tom Minka wrote: > I haven't seen the original code, but the problem with Ray's code is that > the two projections are not synchronized. Specifically, they are using > different (default) values for the orientation. To synchronize the > projections, either specify the orienta

Re: [R] upgraded maps database for italy?

2008-09-05 Thread Ray Brownrigg
e some people still find it useful. Regards, Ray Brownrigg livio spam wrote: Dear UseRs, I'm using the library maps. I'm drawing maps of Italy. The map available for this library were prepared around *1989*: "This italy database comes from the NUTS III (Tertiary Administrative Units

Re: [R] Loop avoidance in simulating a vector

2008-10-16 Thread Ray Brownrigg
If you want to avoid using a loop, rather than coding a loop, then someting like: DV <- rnorm(sum(n)) DV <- DV * rep(sigma, times=n) + rep(mu, times=n) will achieve the same as the loop you specified, but generalised to non-constant n. HTH Ray Brownrigg On Fri, 17 Oct 2008, Bert Gunter

Re: [R] pdf creation error

2008-10-21 Thread Ray Brownrigg
You just don't have write access to the directory you are working in. That's what the second part of the message is telling you. HTH Ray Brownrigg Victoria University of Welington On Wed, 22 Oct 2008, j daniel wrote: > Hello - > > I am trying to create a pdf file in R, bu

Re: [R] Map using projection

2009-03-13 Thread Ray Brownrigg
(but what you want is not exactly clear). [I am not sure why this happens, but it seems to be an artifact of the projection code.] [All your examples have been very confusing, since you talk about plotting the "states", but in fact your example code plots only a grid.] HTH Ray Brownrigg

Re: [R] Map using projection

2009-03-14 Thread Ray Brownrigg
] <- NA mymap$x <- mymap$x[whichxy] mymap$y <- mymap$y[whichxy] map(mymap, projection="azequalarea", type="n") bound<-c(floor(longlatLimit[1]), ceiling(longlatLimit[2]), floor(longlatLimit[3]), ceiling(longlatLimit[4])) map.grid(lim=bound, col="ligh

Re: [R] map geographical boundaries

2008-11-03 Thread Ray Brownrigg
It's not clear exactly what you want, but try something like: library(maps) map("world", xlim=c(35, 100), ylim=c(-5, 35), interior=FALSE) lat= c(-5,0,5,10) long=c(35,40,45,50) points(long, lat, col=2) HTH, Ray Brownrigg On Tue, 04 Nov 2008, Yogesh Tiwari wrote: > Hello, &

Re: [R] missing value where TRUE/FALSE needed

2008-11-08 Thread Ray Brownrigg
show(c(i, j)) + } + } [1] 37 68 [1] 37 1 [1] 46 68 [1] 46 1 > vector1[37] == vector2[68] [1] NA > Does this now answer your question? Ray Brownrigg MSCS, Victoria University of Wellington cruz wrote: is this what you want? vector1 [1] 65 1 34 100 42 20 79 43 89 10 vector2 [1] 34

Re: [R] any alternatives for complex for-loops?

2008-11-11 Thread Ray Brownrigg
vectorisation is taken care of inside complexFn. Ray Brownrigg On Wed, 12 Nov 2008, hadley wickham wrote: > On Tue, Nov 11, 2008 at 8:30 PM, Kinoko <[EMAIL PROTECTED]> wrote: > > Dear list, > > > > Is there a way to do something like the following pseudo-code - > >

Re: [R] Help with maps

2008-12-02 Thread Ray Brownrigg
t;>library(ggplot2) > >>>library(mapproj) > >>>(qplot(x, y, data=(data.frame(map("france", plot=FALSE)[c("x","y")])), > >>> geom="path")) + coord_map() (qplot(x, y, data=(data.frame(map("uk", > >

Re: [R] Help with maps

2008-12-02 Thread Ray Brownrigg
On Wed, 03 Dec 2008, Ray Brownrigg wrote: > The easiest way would be: > map('world', regions="UK", xlim=c(-10, 5), ylim=c(48, 60)) > But of course: map('world', regions=c("UK", "Ireland"), xlim=c(-10, 5), ylim=c(48, 60)) might be more a

Re: [R] maps does not work

2007-10-11 Thread Ray Brownrigg
On Thu, 11 Oct 2007, Lukas Gudmundsson wrote: > Hello, > I am trying to draw geographical maps with the maps package. However > > if I try to access the data following error occurs: > > require(maps) > > map() > > Fehler in zip.file.extract(file, "Rdata.zip") : > 'destination' existiert nicht > #

Re: [R] map - mapproj : problem of states localisation

2007-11-13 Thread Ray Brownrigg
world", col=2, add=T) then try using the "worldHires" database from the mapdata package. HTH, Ray Brownrigg On Wed, 14 Nov 2007, Amandine Chevalier wrote: > Hi R-user, > > I am new with R and I have a problem with the map and mapproj fonctions : > > with the follow

Re: [R] map - mapproj : problem of states localisation

2007-11-14 Thread Ray Brownrigg
On Wed, 14 Nov 2007, Amandine Chevalier wrote: > Thank you very much for your help, > > I work about my code so as to give you the example (attached file) : > > In the first case (azequalarea projection), france from the "france" map > and from the "world" map are well superimposed, whereas in the