![]() Both readr and readxl are part of the tidyverse, which means we should expect their functions to have similar syntax and structure. We also have an Excel file (ci_np.xlsx) that contains observations only for Channel Islands National Park visitation. Adding layers in this fashion allows for extensive flexibility and customization of plots. Graphics with ggplot are built step-by-step, adding new elements as layers with a plus sign ( +) between layers (note: this is different from the pipe operator, %>%. We’ll use the ggplot2 package, but the function we use to initialize a graph will be ggplot, which works best for data in tidy format (i.e., a column for every variable, and a row for every observation). So yeah…that gg is from “grammar of graphics.” With ggplot2, you can do more faster by learning one system and applying it in many places.” - R4DS “ggplot2 implements the grammar of graphics, a coherent system for describing and building graphs. Using ggplot2, the graphics package within the tidyverse, we’ll write reproducible code to manually and thoughtfully build our graphs. Also, if we haven’t built a graph with reproducible code, then we might not be able to easily recreate a graph or use that code again to make the same style graph with different data. In Excel, graphs are made by manually selecting options - which, as we’ve discussed previously, may not be the best option for reproducibility. Then, we’ll write reproducible code to build graphs piece-by-piece. xlsx, and CSV files) into R with the readr and readxl packages (both part of the tidyverse). In this session, we’ll first learn how to read some external data (from. 10.8 Add an image to your partner’s document.10.5 Make a graph of US commercial fisheries value by species over time with ggplot2.10.4 Find total annual US value ($) for each salmon subgroup.10.3 Some data cleaning to get salmon landings by species.10.2 Attach packages, read in and explore the data.9.6.6 How do you avoid merge conflicts?.9.6.4 Sync attempts & fixes (Partner 1).9.6.2 Create a conflict (Partners 1 and 2).9.5.5 Clone to a new R Project (Partner 2).9.5.4 Clone to a new R Project (Partner 1).9.5.3 Give your collaborator privileges (Partner 1 and 2).9.5.2 Create a gh-pages branch (Partner 1).8.5 An HTML table with kable() and kableExtra.8.4.4 filter() and join() in a sequence.8.4.3 inner_join() to merge data frames, only keeping observations with a match in both.8.4.2 left_join(x,y) to merge data frames, keeping everything in the ‘x’ data frame and only matches from the ‘y’ data frame.8.4.1 full_join() to merge data frames, keeping everything.8.4 dplyr::*_join() to merge data frames.8.3.6 stringr::str_detect() to filter by a partial pattern.8.3.5 Activity: combined filter conditions.8.3.4 Filter to return observations that match this AND that.8.3.3 Filter to return rows that match this OR that OR that.8.3.2 Filter rows based on numeric conditions.8.3.1 Filter rows by matching a single character string.8.3 dplyr::filter() to conditionally subset by rows.7.7 stringr::str_replace() to replace a pattern.7.6.2 tidyr::separate() to separate information into multiple columns.7.6.1 tidyr::unite() to merge information from separate columns.7.6 tidyr::unite() and tidyr::separate() to combine or separate information in column(s).7.5 janitor::clean_names() to clean up column names.7.4 tidyr::pivot_wider() to convert from longer-to-wider format.7.3 tidyr::pivot_longer() to reshape from wider-to-longer format.7.2.2 read_excel() to read in data from an Excel worksheet.7.2.1 Create a new R Markdown and attach packages.6.5.1 Knit, push, & show differences on GitHub.3.8 Assigning objects with % summarize().3.4.3 Writing code in a file vs. Console.2.2 Guiding principles / recurring themes.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |