Code Monkey home page Code Monkey logo

2020-02_paleontology's Introduction

Making Paleontology—fauna excercise 8 in R

Preparation

If you’re curious about learning R, this exercise could be a fun little first challenge!

While excel works, it often introduces problems that shouldn’t be there: in this exercise it isn’t able to plot the age in millions of years ago (Ma) as a date, because it doesn’t have enough digits for conversion. As a workaround you can convert it to kyr in stead.

That is obviously stupid. And it’s not the only frustrating excel thing you may run into. One of the nice things about using a scripting language—such as python or R—instead, is that your work becomes reproducible and you and others can use your tricks again in the future!

Here we show you how you could do this exercise in R. Please play around first and enjoy the struggle for a bit.

installation

Install R and RStudio. R is the programming language and RStudio is a friendly graphical interface (or technically Integrated Development Environment) for R.

If you don’t know how, you can follow many online guides, such as this edX course. Note that for Mac users there are some additional installation steps required.

Install the required packages—extensions of R that make life even easier!—by opening RStudio and going to the bottom-left panel (the terminal) and typing, e.g.:

install.packages("ggplot2")

Or, if you want to use ggplot2, dplyr, purrr, etc., which I highly recommend, install them all at once with:

install.packages("tidyverse")

since they are part of the tidyverse, a collection of packages that makes R amazing.

load the libraries

These commands make the package functions available for use in your session:

library(readr)      # to read in the csv file (or use readxslx to read in excel files)
library(ggplot2)    # for plotting
library(patchwork)  # for composite plots
library(dplyr)      # for tidy data manipulation
library(tidyr)

getting started

As a start, I highly recommend reading through the freely available book R for data science by Hadley Wickham. You can also try the datacamp Introduction to R online course, which helped me get started initially. One last resource to get you started is to install the package swirl and interactively learn the basics right from R.

install.packges("swirl")
library(swirl)
swirl()

getting help

When you have problems or questions, have a look at any error messages if present and consult the documentation of the function of interest with, ?function_name or search for a topic with ??topic.

e.g., enter:

?ggplot

in the terminal.

If When you have questions, search! This is not considered cheating! StackOverflow, your search engine, and sometimes even twitter #Rlang are your friends!

2020-02_paleontology's People

Contributors

japhir avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.