Open bpbond opened 5 years ago
function_name (argument1, argument 2, ...)
Example:
If you want to take the sum of 160, 47, and 10, you can use the sum()
function in R
> sum(160, 47, 10)
[1] 217
Good meeting. We covered:
summary()
, nrow()
, max()
, which.max()
, length()
, object[index]
, data frames object[row, column]
$
- object$column
plot()
library()
ggplot2
and its qplot()
functionqplot(x, y, data=some_object, color=column1, size=column2) + facet_wrap(~column3)
Here's the program we wrote:
# Script to find the distance traveled by the fastest car
# B,H,L,M 2019-06-04
car_speeds <- cars$speed
print("The length of the speed vector is:")
print(length(car_speeds))
print(summary(car_speeds))
# Compute position of max speed
max_speed_pos <- which.max(car_speeds)
print("The index of the maximum speed value is:")
print(max_speed_pos)
print("The corresponding distance is:")
print(cars$dist[max_speed_pos])
Goal:
to use CO2 flux data to open a dataset in RStudio and create a basic plot
Data used: https://github.com/PNNL-PREMIS/SULI/blob/master/Rworkshop1_20190604_CO2.csv https://github.com/PNNL-PREMIS/SULI/blob/master/Rworkshop1_timeseries_HSLEcontrols.csv
RStudio
Handling data: using tidyverse functions
readr::read_csv()
summary()
,head()
,tibble::glimpse()
Visualizing with ggplot
ggplot2
packageHandouts used: https://www.rstudio.com/resources/cheatsheets/