Skip to main content

Posts

R for beginners and intermediate users 2: extracting subsets of data

For my second post on R, I think I will address how to extract subsets of data based on some selection criterion like taxon names. For instance, I have a huge dataset of morphometric variables for at least 36 species of cats (living and fossil). Sometimes I'd like to do some stats on a subset of this dataset, like all the living cats or just on the Panthera lineage species ( Panthera and Neofelis ). Till recently, I've been doing most of my dataset manipulation in Excel by filtering out certain taxa from the spreadsheet and copy-pasting to a text file, which I read into R. However, you can select subsets of data in R based on taxon names. In my dataset that I call cat , I have a column labelled Taxa which contains all my taxon names. So typing cat$Taxa would be the way to call up my taxon names. Let's say I want to extract from my dataset cat just the data for the lion Panthera leo . The associated taxon names in cat$Taxa would be Panthera_leo . So to extract that ...

Old drawings: Allosaurus, ambush predator

I was flipping through an old sketch book yesterday (only because I was looking for spare large-sized sketch paper for some possible figures in preparation for a manuscript I'm currently working on) and I came across a few old dinosaur drawings that I had completely forgotten about. I present one here. It's an Allosaurus  squatting behind some foliage waiting for the right moment to burst out to attack the group of Stegosaurus . It's even inching forward little by little to get to the perfect position. I wouldn't be surprised if Allosaurus was an ambush predator; lying in wait till the right time to attack, then sprinting up to its prey and delivering a slashing bite to inflict serious wounds to its prey. With it's relatively small teeth, Allosaurus  doesn't fit the bill for an average theropod (even though it is frequently cited as being the quintessential theropod). However, Allosaurus had an incredible gape and very strong neck muscles. So Bakker (1998)...

How to test if your milk is about to go off

I just 'discovered' this morning that there is a way to test if your milk is about to go off even if it still looks, smells and tastes normal, although you know it's pretty old already. If that's the case and you're worried your milk is about to go off, then here's something you can do to see if it actually is close to going off: Take some of the milk and microwave it for about 30 seconds. If it's actually pretty old then the milk should curdle; if not, you've got yourself a nice cup of warm milk. Alternatively, you can pour some of the said milk into a cup of hot tea or coffee and see the same effect but you'll end up wasting a perfectly good cup of tea or coffee!

Quick update - two year old Pachyrhinosaurus project

I don't know if anyone remembers this ancient post  and this follow-up on my Pachyrhinosaurus  reconstruction, but I've just yesterday pulled out my half-finished drawing and started my process of finishing it.  I just realised that my original post was about 2 years ago; it's about time I finished the darned thing.  I've completely abandoned layering by anatomy (e.g. layers of muscle, skins) and reverted to my comfortable method of just fleshing it out the way I like. I've realised it's the only way to get it finished! I also have to make my post on plotting in R...

R for beginners and intermediate users: reading and manipulating data

I had been preparing a comprehensive tutorial on how to plot in R ( The R Project ) with different groups differentiated in different colours, but Blogger stupidly erased my post and decided to automatically save my empty draft at that precise moment. Since I cannot reproduce the original post, I decided to break it up into a series of smaller topics. There are plenty of R resources available in various places but I found that they are frequently one of two extremes; either too basic or too advanced.  I think of myself as an intermediate user (i.e., I can comfortably handle canned packages but want a bit more control than the default settings allow) so the type of info I find are not too helpful. So I thought it would benefit others like me if I summed up some of the simple things I learned over the last year or two. As a first of such posts, I will deal with reading in and manipulating data.  These may be very simple and basic, but some of the things I wanted to do req...

I hate Blogger autosave!

Until now, I quite liked Blogger's auto save feature.  Not any more.  I was hitting Ctrl Z to undo things until for some reason the whole post disappeared, and then at that moment, Blogger decided to auto save.... I lost a whole evening's worth of blogging and I can't remember the phrasing I used which I really liked.

Man-eater!

I have been meaning to write about this for the longest time, but things kept getting in my way.  Now, I have the perfect opportunity, as Paolo at Zygoma has coordinated with me to write a post on this very topic .  When Paolo was at the Bristol City Museum, I used to go bother him a lot, and together we'd go through their extensive cat skull collection.  One day, we came across a very interesting tiger skull specimen.  The box kind of said it all; it was labelled 'TIGER' on one end and 'MAN-EATER' on the other.  So we excitedly opened the box and found an isolated skull with no mandible but with a handwritten label.  The label read: So this tiger was hunting humans for two years (how regularly, no one knows) until someone shot it dead.  Upon examining the skull it was apparent why this tiger was preferentially hunting humans; its canines are heavily worn down. The canines even look like they could have broken and were subsequently worn down f...