« first day (672 days earlier)      last day (2503 days later) » 

6:37 AM
good morning to everyone
 
Good morning
 
7:37 AM
@Spacedman You probably knew this, but after battling ggplot for 2 hours, I've concluded that it can't plot holes.
But then again, Hadley said as much in 2010: groups.google.com/group/ggplot2/tree/browse_frm/month/…
 
8:09 AM
YOu made it draw square holes
 
Ah, I found the feature I was looking for. I was looking for a function that runs the command and outputs the result as a commented text. Turns out that this is Eclipse/StatET goodie. Ctrl+R Ctrl+V.
 
@Spacedman Yes, you can make holes.
But the holes are "proper" only in certain circumstances.
ggplot always draws a line from one shape (hole) to the next. If that line bisects another polygon, then all hell breaks out.
As illustrated neatly by this question:
-2
Q: Strange ggplot output for geom_polygon with multiple holes

lokheartI refer to the question I asked before and further modified the script: library(ggplot2) ids <- letters[1:2] # IDs and values to use for fill colour values <- data.frame( id = ids, value = c(4,5) ) # Polygon position positions <- data.frame( id = c(rep(ids, each = 10),rep("b",5...

 
yes.
now you just cycle the points in each hole until the jump between rings is suitable :)
or you rasterize...
 
8:25 AM
Why is that Q being closed as too localized? Because the user asked if it's a bug?
 
@RomanLuštrik Because it's the 5th identical question he's asked. And because he's filing a bug report on a feature that isn't supported.
@Spacedman Yep, on his other question I tried to cycle the holes, but haven't quite cracked it yet.
@RomanLuštrik And because I'm in a foul mood, which wan't helped by me spending way too much time on this question already. And the fact that the OP hasn't accepted any of his previous answers on the identical topic.
 
Alright, I'll buy it. Can you put that into the comment section? :)
 
What, the bit about me being a grumpy git?
 
I think I remember how I did this in my shapemap package...
you have to make sure each hole is drawn as a 'spur' from the same point in the outer ring
if you look at lokh's example just deleted...
 
@Andrie Hehe, no, you can filter out the grumpy bit. :) I think that user has been on SO a long time and I have a feeling that he will accept a critic.
 
8:40 AM
the problem is that it does the outer ring, jumps to one square, jumps to the other, then back. If you add some extra coordinates so it jumps back to the same locaiton on the outer polygon after every inner hole, it (might) just work
 
There we go, 3 close votes and problem solved.
 
heh. yeah, it works for me :)
now, do we bother telling him? its 09:43 and I should really go to work
Right, Told him. I haven't even made my lunchtime sandwiches yet. I'll miss coffee break at 11:15 now. Maybe.
Holey polygons batman!
3
 
9:33 AM
@Spacedman No news, but you are an amazing genius:
0
A: plotting land with hole using ggplot2

AndrieWith a nod to @spacedman: library(plyr2) map.shp2 <- ddply(map.shp, .(piece), function(x)rbind(x, map.shp[1, ])) ggplot(data=map.shp2) + geom_polygon(aes(x=long,y=lat))

 
kthx
it was my rmap package that did that, I think.
Or at least it was while I was developing rmap that I worked it out
And i've made it to work in good time for coffee break.
 
 
1 hour later…
10:56 AM
Please close as exact duplicate: stackoverflow.com/q/12036572/602276
 
 
2 hours later…
1:02 PM
@Andrie @Spacedman Is that really the problem? Isn't that just a straight out bug in geom_polygon then, or where ever ggplot2 should be doing validation on sensible polygons? Either it should harmlessly close the rings or complain that it needs them closed
 
I don't think it sees them as rings... Its just drawing a polygon, and if the polygon is self-intersecting, it uses the winding number.
 
sorry, is the winding number a value in the fortified data.frame or something else?
 
its the algorithm for deciding how to fill a polygon
 
like polypath, or like counter-clockwise vs. clockwise?
 
hmm kinda...
 
1:05 PM
@mdsumner I've checked each polygon - all of them are entirely closed.
 
:The term winding number may also refer to the rotation number of an iterated map. In mathematics, the winding number of a closed curve in the plane around a given point is an integer representing the total number of times that curve travels counterclockwise around the point. The winding number depends on the orientation of the curve, and is negative if the curve travels around the point clockwise. Winding numbers are fundamental objects of study in algebraic topology, and they play an important role in vector calculus, complex analysis, geometric topology, differential geometry, and phy...
 
that's polypath
 
Also, given that @Spacedman's solution works for ggplot as well, I suspect it's a feature of grid polygons, not a ggplot bug, per se.
 
eek, I forgot about that
there's a reason I haven't explored ggplot2 . . .
surely not though
 
Hi Gavin. Way to spam the twitter universe. Had to unfollow. Let us know when the conference is over.
 
1:17 PM
@Andrie ah, so it's just the OP's data then - there's no checks in the use of geom_polygon on whether it makes sense
using the example SpP from ?"SpatialPolygonsDataFrame-class" the following works fine: ggplot(fortify(SpP), aes(x = long, y = lat)) + geom_polygon()
sorry, just catching up
 
@DirkEddelbuettel says the man whose phone tweets all by itself :)
 
in that example, if the hole is degenerate like this, you can see another difference:
Sr4 = Polygon(cbind(c(5,6,6,5,5),c(6,6,3,3,6)), hole = TRUE)
plot(SpP, col = "grey", usePolypath = TRUE)plot(SpP, col = "grey", usePolypath = FALSE)
sorry, mean to have a new line there - and sorry if this is not interesting, something for me to explore/learn later
 
@DirkEddelbuettel I suspect @GavinSimpson is too busy spamming the twitterverse to pay any attention to what's being said here.
 
@Spacedman True but 1 << several_dozens_spanning_several_days
 
Aren't you enjoying the thrilling paleolimnology?
 
1:31 PM
@Spacedman It got so exciting that my cardiologist recommended that I'd unsubscribe.
 
Hypoxia eh?
 
Who' have thought? "Occluded OM laye is about 0.1% of a diatom frustule. Composed of amino acids so can be extracted & used for C N isotopes"
This is very funny: stackoverflow.com/a/12056019/602276 I might just have to upvote.
 
1:50 PM
@DirkEddelbuettel You' obviously don't follow many scientists - common convention to tweet talks. Sorry though should have said I would be tweeting science this week
 
@GavinSimpson Well, I enjoyed your tweet about the reaction to R for Dummies :-)
 
Sorry chaps - this is my alter ego when I'm not writing R code.
@Andrie All true - fellow course teacher recommended it to the course without prompting from me.
 
@GavinSimpson That's brilliant. Exactly what we need!
Would he/she be prepared to write a review?
 
@Andrie Possibly, but he's a palaeo scientist too so not sure where he might put it.
 
@GavinSimpson Thomas Dolby blinded me with science so I am limited in my ability to follow so many brilliant minds.
 
1:59 PM
@GavinSimpson Amazon is a good place - doesn't have to be a tech journal.
 
@Andrie See what you mean. Will ask when I see him next.
 
 
2 hours later…
@JoshuaUlrich Interested in forming a team, anyone?
 
@Andre Snark week has begun?
 
@Andrie I'm not interested in participating, but I'd like the final model so I can know when to vote to close a question.
 
@Justin Didn't want to be too snarky. Comment removed.
 
@JoshuaUlrich you vote to close a question when a) it is a bit rubbish, and b) when someone on the chat says "hey guys, can we gang up on this question and close it?"
 
4:31 PM
@Andre too bad, cause I've been working on some good one liners!
 
I think perhaps I should ban myself from SO. Clearly I've had too much.
@Justin You can always try them out here.
 
@Andrie, I deleted mine too. you can cleanup if you like
 
wheres the snarking?
 
Coming up:
@Justin I'm going to downvote you for using lubridate, since we all know that none of Hadley's packages have high performance.
 
Hi Gavin. How's the conference?
 
4:38 PM
@Andre HA! touche, but that portion of the question has mysteriously disappeared
If only Hadley could write packages that just took whatever I have and output whatever I want and only took a fraction of a second... that'll be the next release clairvoyance2
 
@JoshuaUlrich I think we should write a closing bot instead.
 
@Spacedman Good actually - much nicer when you don't have a poster to stand next to or talk to give.
 
you can just tweet all day :)
 
@Spacedman Well, when I'm not drinking at least. Can't do too much tweeting though as I might loose my non-sci follows because of the spam - c.f. @DirkEddelbuettel :P
 
twitter needs an 'unfollow this person for X days' button :)
3
 
4:55 PM
@Spacedman +1
 
5:08 PM
@GavinSimpson ++1
 
5:34 PM
SO needs a "automatically close all questions by this OP for X days" button.
 
@Andre I'll second that idea!
 
@Andrie Me too. So who is the offender now?
 
5:49 PM
No one in particular. I'm just having a grumpy day.
 
@Andrie Do you need a hug?
~2.6s -> 0.05s... not bad at all: stackoverflow.com/q/12059227/271616
@Spacedman That's precisely why I add people to my "refollow later" list.
 
6:12 PM
nice idea
 
 
2 hours later…
7:46 PM
anyone on?
 
Just us crickets.
 
haha
having an issue with using optim function and have trawled through many books and the net to no avail. I have no issue with the statisitics underpinning anything but i am having issues inserting data in the correct manner. I have 2 vectors feeding into the function to be optimised and have been told that this itself presents an issue.
 
your function returns a matrix. optim needs a scalar return value to minimize.
 
ok thanks. So my input values are not alterable. they are what they are (one 40 item vector and one 40*2 item vector), therefore optim does not seem appropriate so what should i be using? is nlm any good in this scenario?
 
@user1511911 Combine your two vectors into one vector. The first 40 elements belong to input one and the remaining 40*2 elements belong to input two. But that's not what @Justin said. He said that your output isn't a scalar.
 
8:02 PM
your input values don't need to change. Just your function. It needs to return a scalar. you can also poke around here
 
@Justin thanks will have a look
 
@JoshuaUlrich Aw. Sweet! Thank you. Feeling much better now.
 
9:05 PM
ok figured out what i need to do, quick question, how do i select one item at a time from a 40*2 vector?
 
One item at a time.
 
yep
 
x[3]
 
9:07 PM
Or maybe you're thinking of a loop. for (i in 1:10) x[i].
 
...
x[i]
 
yes i meant one at a time, for the R data (stackoverflow.com/questions/12021493/optimisation-issue-in-r) for insertion into the function Data1
i knew about the x[1] thing (not quite that bad)
 
:-)
@YesSure Can you rewrite that question to be more realistic? In other words, make up a function that does something when you feed it the data you provide?
Try to be as specific as you can. The better the question, the easier it is to help you.
If needs be, copy an example from ?optimize
 

« first day (672 days earlier)      last day (2503 days later) »