x <- seq(from = 5, to = 23, length.out = 10) # create a sequence of numbers
y <- seq(from = 0.1, to = 0.78, length.out = 10) # Create another sequence
mean(x*y) # Get the mean of the multiplication
[1] 7.406667
Objects:
- x
- y
Operators:
- *
- <-
Functions:
- seq()
- mean()
Arguments:
- from
- to
- lengt.out
select()
to select specific columnsslice()
to select specific rows based on positionfilter()
to select specific rows based on a conditionmutate()
to create new variablesOther function we reviewed:
count()
Count rows by one or more groupsgroup_by()
aggregate the data by one or more groupssummarise()
applies functions to the grouped variablesComponents needed to define a graphic:
Types of vectors:
ggplot() + # create the empty canvas
geom_stars(data = Mxst) + # add raster layer
geom_sf(data = Area, fill = NA, col = 'grey60') + # add polygon layer
geom_sf(data = capturesSp, cex = 0.3, col = 'skyblue') +
theme_void() +
scale_fill_gradient(low = 'black', high = 'red', na.value = NA) +
labs(fill = 'Altitude')
ggplot() + # create the empty canvas
geom_stars(data = Mxst) + # add raster layer
geom_sf(data = Area, fill = NA, col = 'grey60') + # add polygon layer
geom_sf(data = capturesSp, cex = 0.3, col = 'skyblue') + # add point layer
theme_void() +
scale_fill_gradient(low = 'black', high = 'red', na.value = NA) +
labs(fill = 'Altitude')
ggplot() + # create the empty canvas
geom_stars(data = Mxst) + # add raster layer
geom_sf(data = Area, fill = NA, col = 'grey60') + # add polygon layer
geom_sf(data = capturesSp, cex = 0.3, col = 'skyblue') + # add point layer
theme_void() + # theme for the figure
scale_fill_gradient(low = 'black', high = 'red', na.value = NA) +
labs(fill = 'Altitude')
ggplot() + # create the empty canvas
geom_stars(data = Mxst) + # add raster layer
geom_sf(data = Area, fill = NA, col = 'grey60') + # add polygon layer
geom_sf(data = capturesSp, cex = 0.3, col = 'skyblue') + # add point layer
theme_void() + # theme for the figure
scale_fill_gradient(low = 'black', high = 'red', na.value = NA) + # color for the gradient
labs(fill = 'Altitude')
ggplot() + # create the empty canvas
geom_stars(data = Mxst) + # add raster layer
geom_sf(data = Area, fill = NA, col = 'grey60') + # add polygon layer
geom_sf(data = capturesSp, cex = 0.3, col = 'skyblue') + # add point layer
theme_void() + # theme for the figure
scale_fill_gradient(low = 'black', high = 'red', na.value = NA) + # color for the gradient
labs(title = 'Map of the study area', fill = 'Altitude') # labels for the figure
Identify individuals that are very active
Identify individuals that are intermediate
Nodes (vertices)
\[V = [1, 2, 3, ..., i]\]
Nodes (vertices)
\[V = [1, 2, 3, ..., i]\]
Edges (links)
\[E = [(1, 2), (1, 3), (2, 3), ..., (i,j)]\]
Network attributes
\[V = [0, 1, 1, ..., x_i]\]
# A tbl_graph: 40 nodes and 1611 edges
#
# A directed multigraph with 1 component
#
# A tibble: 40 × 1
name
<chr>
1 17
2 12
3 14
4 11
5 7
6 9
# ℹ 34 more rows
#
# A tibble: 1,611 × 6
from to date pigs.moved type_orig type_dest
<int> <int> <chr> <int> <chr> <chr>
1 1 7 8/20/15 160 finisher sow farm
2 1 7 8/20/15 76 finisher sow farm
3 1 3 9/11/15 155 finisher nursery
# ℹ 1,608 more rows
%>%
?%N>%
for nodes%E>%
for edgesggraph(net, layout = 'kk') + # this is our empty canvas
geom_edge_link(aes(width = pigs.moved)) + # Add the edges
geom_node_point() + # Add the nodes
scale_edge_width(range = c(0.01, 0.9)) + # we set the range for the width of the edges
labs(title = 'Title for the plot', edge_width = 'Number of pigs moved') # labels for the figure
Network analysis in R
From this we could conclude:
A description of the health event and its context, current state of knowledge and potential risk management options
To facilitate the search for data, eligibility criteria should be defined that take into account:
Type of outputs might include:
Risk assessment in R