Read in one (or more) of the following data sets, using the correct R package and command.
got_marriages.csv
fish_encounters dataset (available in the tidyr package)
got_like_dislike.csv
Find the _data folder, located inside the posts folder. Then you can read in the data, using base read.csv or read_csv standard tidy read command to read Comma Separated Values files or, alternatively, read the data in directly from loading a package.
i Use `spec()` to retrieve the full column specification for this data.
i Specify the column types or set `show_col_types = FALSE` to quiet this message.
Add any comments or documentation as needed. More challenging data sets may require additional code chunks and documentation.
Create a Network
Load the package igraph and create an igraph object (i.e. a graph or network) in the form of an edge list. The command may vary whether the data is given as a list of connections or an adjacency matrix. Is the network directed or undirected; weighted or unweighted; unimodal or bipartite? Can you plot it?
Code
library(igraph)
Attaching package: 'igraph'
The following objects are masked from 'package:dplyr':
as_data_frame, groups, union
The following objects are masked from 'package:purrr':
compose, simplify
The following object is masked from 'package:tidyr':
crossing
The following object is masked from 'package:tibble':
as_data_frame
The following objects are masked from 'package:stats':
decompose, spectrum
The following object is masked from 'package:base':
union
---title: "Week 1 Challenge"author: "Ben Ramsey"description: "Loading Data and Creating a Network"date: "02/13/2023"format: html: toc: true code-fold: true code-copy: true code-tools: true# editor: visualcategories: - challenge_1 - instruction # - railroads # - faostat # - wildbirds---```{r}#| label: setup#| include: false```## Challenge OverviewToday's challenge is to1) read in a dataset, and2) create a network object## Load the DataRead in one (or more) of the following data sets, using the correct R package and command.- got_marriages.csv- fish_encounters dataset (available in the `tidyr` package)- got_like_dislike.csvFind the `_data` folder, located inside the `posts` folder. Then you can read in the data, using base `read.csv` or `read_csv` standard tidy read command to read Comma Separated Values files or, alternatively, read the data in directly from loading a package.```{r}library(tidyverse)got_marriages <-read_csv("_data/got/got_marriages.csv")```Add any comments or documentation as needed. More challenging data sets may require additional code chunks and documentation.## Create a NetworkLoad the package `igraph` and create an `igraph` object (i.e. a graph or network) in the form of an edge list. The command may vary whether the data is given as a list of connections or an adjacency matrix. Is the network directed or undirected; weighted or unweighted; unimodal or bipartite? Can you plot it?```{r}#| label: summarylibrary(igraph)got_marriages.ig <-graph_from_data_frame(got_marriages, directed =FALSE)is_directed(got_marriages.ig)is_weighted(got_marriages.ig)is_bipartite(got_marriages.ig)plot.igraph(got_marriages.ig)```