1.get the content of Get(‘website’)
2.extract the desired table: tables[]
3.if function: if else (danger_table$crit == "nat", 19, 2)
4.histogram: hist ()
5.rm(object): remove the object
6.round (3.65) = 3
All the results are 3
round(3.65, digits = 1)
round(3.65, 1)
round(digits = 1, x = 3.65)
7.pay attention to string ‘’ v.s. number
9.c(): to convert that into a vector; can also combine vectors together
TRUE
becomes 1 while FALSE
becomes 0. This is decided by which type is the most essential.
If you want to collect together things that are not of the same type, what you need is a list()
. A list is an arbitrary, but ordered, collection of things: Characters, numbers, vectors, other lists, functions.
If you need to store information in a two-dimensional format, what you want is probably a data.frame()
. A data frame is just a list of vectors of equal length, with named columns. Think of it as a spreadsheet like you use in Microsoft Excel.
my_df[2, 2] : returning the item in row 2, column 2