Skip to content

Using R to Import and Perform Simple Calculation on Multiple Files

July 25, 2013

My first post about using R back in January focused on creating custom plots and led to some interaction with other R users in the comment thread and this post from R expert Gavin Simpson in which he kindly offered a solution (and code) to what I was trying to do. I ended up using a slightly modified version of that code to make a bunch of plots for a paper I’m working on. (In fact, I should be working on that paper right now … yep.)

Anyway, for this post I want to briefly summarize another aspect of R (or most programming languages for that matter) that is quite powerful: automating data processing and/or computational tasks that need to be done for multiple files. This funny graphic* below was going around some months ago and very nicely illustrates what I’m talking about.

geeks-repetitive-tasks

Just a bit of background before I get on to the R code. I’m starting some research that will take me and my current/future students at least a few years, perhaps more, to accomplish simply because of the huge number of samples. I have a literal boatload of deep-sea sediment samples from IODP Expedition 342 (see this post for context) that will be used to better understand the history of deep ocean circulation in response to past climate change. Specifically, we’ll be measuring the variability in grain size of the terrigenous (land-derived, non-biogenic) sediment through time. To the naked eye, all this sediment is mud. But, subtle differences in the mean size of the silt fraction over time can tell us about the relative intensity of long-lived abyssal currents that transported the sediment. (If you want to know more about this approach, including all the assumptions, limitations, and caveats, this is a nice review.)

Read more…

Friday Field Photo #186: Coastal California Turbidites

July 12, 2013

DSCF9895

It’s been two years since we moved from California to Virginia, time flies! We really love where we live now, but there are times where I do miss California. I especially miss exploring the outcrops along the coast. Many of these wave-washed bluffs have gorgeous exposures of bed-scale sedimentary geology, a real delight for those who like sedimentary structures.

The above photo shows some Paleocene turbidites along beach cliffs in the town of Gualala, a few hours north of the Bay Area.

Happy Friday!

Friday Field Photo #185: Las rocas del otro lado del río

June 28, 2013

riozamora

This photo is from the past field season in Patagonia. We wanted to get to these rocks on the other side of the river. My student eventually got there … by going ~30 km downstream to where there was a proper bridge and then driving on some gnarly roads for a couple hours. If only we had jet packs. Drones are all the rage these days … drones shmones, I want jet packs!

Happy Friday!

Summertime research in the lab

June 12, 2013

samples

Summer is in full swing and this summer is all about lab work. An undergraduate researcher and I are in the midst of extracting the terrigenous (land-derived) sediment from marine sediment. We are interested in the grain-size and compositional characteristics of the terrigenous component to better understand the history of a long-lived oceanic current that transported the sediment. Isolating the terrigenous material means we have to get rid of the other components, namely the biogenic (marine microfossils made of carbonate and opal) and authigenic (metalliferous oxyhydroxides that formed in place) material. We are using this method with some tweaks from a helpful collaborator.

I have >1,000 samples from IODP Expedition 342 (see this post for more about that expedition) that will eventually be processed in this way. But, because we have not done this before and are still getting the lab fully equipped, we are currently using ‘practice’ sediment (a chunk from one of the core catchers) to fine-tune the methodology. That is, when we make a mistake — which is inevitable when learning something new — we won’t be sacrificing a ‘real’ sample. This training will pay off in a couple weeks as we ramp up and start processing samples in batches.

While we work on that two of my graduate students are busy crushing, grinding, sawing, drilling, etc. rock samples for their respective Ph.D. projects. We’ve got mineral separation underway for bedrock thermochronology, sample preparation for stable isotope measurement of carbonate rocks, and thin sections being made.

Summertime!

Friday Field Photo #184: Death Valley Dunes

May 31, 2013

death-valley

Here’s a shot of the sand dunes not far from Stovepipe Wells in Death Valley National Park from this past March. Check out this Flickr set for a whole bunch more. Happy Friday!

Friday Field Photo #183: Evening sun on the open ocean

May 10, 2013

7926880256_d21cc18c6f_b

This week’s photo is from the deck of the JOIDES Resolution drill ship last summer. Before IODP Expedition 342 I had spent only a few days at sea, and even then it wasn’t more than ~20-30 km from land. Being out in the open ocean — several hundred km from land — was an experience I didn’t think about or appreciate before I did it.

I never grew tired of watching the sea during that two months. The interaction of swells of different sizes and forms moving in different directions resulted in unique displays of nature. And it’s quite different than watching the sea near the coast. Watching the water pile up into ‘mountains’ and ‘ridges’, creating a constantly changing topography, was actually quite therapeutic during an incredibly busy expedition.

Happy Friday!

See this photo and many more from IODP Expedition 342 on my Flickr page.

Amazing view of the Mississippi River delta

May 8, 2013
Mississippi River delta from the International Space Station (photo by @Cmdr_Hadfield)

Mississippi River delta from the International Space Station (photo by @Cmdr_Hadfield)

I just had to share this image that Commander Chris Hadfield, an astronaut currently on the International Space Station, posted yesterday. I really like this perspective of the Mississippi River delta. It’s nice to get a view that isn’t a standard map (north to the top and looking straight down). This slightly oblique view emphasizes how ‘delicate’ the bird’s foot part of the delta is, that the boundary between what is land and what is not is a bit blurred.

I’ll also use this post as a plug for Commander Hadfield’s Twitter feed. It’s really quite simple — he takes photos of the Earth out the window of the space station and shares them. There isn’t a link to some busy web page or other social media noise, just a beautiful photo of our planet. And he does several each day. Simple and awesome.

Follow

Get every new post delivered to your Inbox.

Join 112 other followers