# welcome to week 8! library(tidyverse) species.dot <- read.csv("data/raw_data/species.csv") species.dot species_underscore <- read_csv("data/raw_data/species.csv") species_underscore str(species.dot) surveys.dot2 <- read.csv("data/raw_data/species.csv", stringsAsFactors = FALSE) str(surveys.dot2) read.csv2() read.csv(sep = ";") read_csv() ?read_table read_csv("data/wide_eg.csv") read_csv("data/wide_eg.csv", skip = 2) # exporting a CSV write_csv(x = species.dot, path = "data/cleaned_data/species_dot_written.csv") # .rda and .rds files save(species.dot, species_underscore, file = "data/cleaned_data/species_dataframes.rda") load(file = "data/cleaned_data/species_dataframes.rda") species.dot species_underscore saveRDS(species_underscore, file = "data/cleaned_data/species_underscore.rds") new_species_underscore <- readRDS(file = "data/cleaned_data/species_underscore.rds") gapminder <- read_csv("data/gapminder.csv") surveys <- read_csv("data/raw_data/portal_data_joined.csv") surveys %>% ggplot(aes(x = year, y = hindfoot_length, color = )) + geom_jitter() ggsave(filename = "surveys_hindfoot_year_species.jpg", width = 6, height = 6) ?ggsave # some cool packages to import and export weird data types #readxl:: #googlesheets4:: #foreign:: #rio:: #Datetimes in R! #Date is a data format that R recognizes #Three basic time classes in R #1. Date: just for dates (2/25/2019) #2. Datetime: POSIXct best for dates with times #3. POSIXlt #PRO TIP! #When you enter your data in seperate columns for year, month, day and time sample_dates_1 <- c("2018-02-01", "2018-03-21", "2020-02-25", "2019-04-04") sample_dates_1 <- as.Date(sample_dates_1) #The only reason that worked is because the format is correct: YYYY MM DD sample_date_2 <- c("02-25-2020", "04-04-1988", "05-05-2019", "06-01-2020") sample_date_2 <- as.Date(sample_date_2) #R doesn't like this format sample_date_2 <- as.Date(sample_date_2, format = "%m-%d-%Y") #see lesson for cheatsheet #05A21A1998 # format = %mA%dA%Y july <- c("July 04, 2019", "Nov 08, 2019", "July 17, 2019") july <- as.Date(july, format = "%B %d, %Y") july time <- c("2016-07-24 22:55:01", "2013-04-12 18:50:11") #Nice format, YYYY MM DD, HH:MM:SS this is what R is looking for time <- as.POSIXct(time, tz = "GMT") time