##Import data

data <- read_excel("../00_data/myData.xlsx")
data
## # A tibble: 805 × 16
##    decimalLatitude decimalLongitude eventDate      scientificName taxonConceptID
##              <dbl>            <dbl> <chr>          <chr>          <chr>         
##  1           -37.6             146. NA             Myrmecobius f… https://biodi…
##  2           -35.1             150. 2014-06-05T02… Myrmecobius f… https://biodi…
##  3           -35               118. NA             Myrmecobius f… https://biodi…
##  4           -34.7             118. NA             Myrmecobius f… https://biodi…
##  5           -34.6             117. NA             Myrmecobius f… https://biodi…
##  6           -34.6             117. NA             Myrmecobius f… https://biodi…
##  7           -34.6             118. NA             Myrmecobius f… https://biodi…
##  8           -34.6             117. NA             Myrmecobius f… https://biodi…
##  9           -34.6             117. NA             Myrmecobius f… https://biodi…
## 10           -34.6             117. NA             Myrmecobius f… https://biodi…
## # ℹ 795 more rows
## # ℹ 11 more variables: recordID <chr>, dataResourceName <chr>, year <chr>,
## #   month <chr>, wday <chr>, hour <chr>, day <chr>, dryandra <lgl>, prcp <chr>,
## #   tmax <chr>, tmin <chr>

##Pivoting

###wide to long form

data_long <- data %>%
    
    pivot_wider(names_from = year, 
                values_from = month)

##Seperating and uniting ###Separate a column

data_sep <- data %>%
    
    separate(col =year, into = c("2016", "2017"))
## Warning: Expected 2 pieces. Missing pieces filled with `NA` in 805 rows [1, 2, 3, 4, 5,
## 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, ...].

###Unite two columns

data_sep %>%
    unite(col = "year", month:day, sep = "/")
## # A tibble: 805 × 14
##    decimalLatitude decimalLongitude eventDate      scientificName taxonConceptID
##              <dbl>            <dbl> <chr>          <chr>          <chr>         
##  1           -37.6             146. NA             Myrmecobius f… https://biodi…
##  2           -35.1             150. 2014-06-05T02… Myrmecobius f… https://biodi…
##  3           -35               118. NA             Myrmecobius f… https://biodi…
##  4           -34.7             118. NA             Myrmecobius f… https://biodi…
##  5           -34.6             117. NA             Myrmecobius f… https://biodi…
##  6           -34.6             117. NA             Myrmecobius f… https://biodi…
##  7           -34.6             118. NA             Myrmecobius f… https://biodi…
##  8           -34.6             117. NA             Myrmecobius f… https://biodi…
##  9           -34.6             117. NA             Myrmecobius f… https://biodi…
## 10           -34.6             117. NA             Myrmecobius f… https://biodi…
## # ℹ 795 more rows
## # ℹ 9 more variables: recordID <chr>, dataResourceName <chr>, `2016` <chr>,
## #   `2017` <chr>, year <chr>, dryandra <lgl>, prcp <chr>, tmax <chr>,
## #   tmin <chr>