Join Mark Niemann-Ross for an in-depth discussion in this video Recursing directories and gathering image data, part of Code Clinic: R (2015).
(intro effect) - Hello and welcome to Code Clinic. My name is Mark Niemann-Ross and I'm the Content Manager for the Developer Segment an lynda.com. Code Clinic is a course where I introduce a problem to a collection of lynda.com authors. In turn, those authors use their computer programming language of choice to produce a unique solution. You can learn several things from Code Clinic. Different approaches to solving a problem.
The pros and cons of different languages. And some tips and tricks to incorporate into your own coding practices. This month I'm introducing a problem combining two concepts. Recursion and accessing image data. Recursion means to repeat something in a similar way. In programming it often means that a function will actually call itself. Nesting a call to a subroutine withing a call of the same subroutine. Look for these in the code samples you're about to see.
Image data is stored in JPEG files as Exif. Exif stands for Exchangeable image file format. And is a well documented standard. If you have a digital camera or have taken photos with a newer cellphone camera the image probably has Exif data available. Using a Macintosh, you can see this Exif information by opening the image in Preview. Opening Tools, Show Inspector and selecting the Exif tab.
You'll see things like Dimentions, Camera type, Color space, Exposure information and other details. Cellphones will also embed geographic location data. Identifying the longitude and latitude of the image. We've given our authors a directory that contains sub directories. Some of those sub directories contain additional sub directories and some of them contain images. We then ask the authors to assume a directory structure of unknown depth. Find any photos, and then extract metadata with the geographic location, file type and path name.
Then we ask them to reorganize those photos into a folder structure based on the name of the description. As always you may want to take some time and solve the problem yourself. In the next videos we'll see how I answered this challenge.
Mark introduces challenges and then provides an overview of his solutions in R. Challenges include topics such as statistical analysis, searching directories for images, and accessing peripheral devices.
Skill Level Intermediate
Q: R Studio tells me that it can't find files I expect to be available. Where can I find them?
A: Use the setwd() command to set the working directory to match the folder you're working in.
Q: I am unable to access the Lake Pend Oreille data from outside the U.S.
A: A static copy of this data is provided here for lynda.com members outside of the U.S.
R Statistics Essential Trainingwith Barton Poulson5h 59m Intermediate
1. Problem One: Statistical Analysis
2. Problem Two: Image Analysis
3. Problem Three: Eight Queens
4. Accessing Peripherals
5. Recursion and Directories
Walking the directory sort code10m 56s
6. Building the Web
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.