STA130H1 Chapter Notes - Chapter 1-3: Data Type, Decimal Mark, Scatter Plot
yifanyang and 40045 others unlocked
23
STA130H1 Full Course Notes
Verified Note
23 documents
Document Summary
R lets you save various types of data types as objects, also known as variables. The main data types used in r are, doubles, integer, character, logical, and factors. Functions are built in procedures used to do simple to complex tasks. Round(3. 1415, 2): this will round the number to two decimal places (3. 14). By default, the number of rounding digits are set to 0. Mean(1,3): this function calculates the average of any set of numbers. Factorial(4): this function calculates the factorial of the number provided. Sample(x = 1:4,y = 2, replace = true) # the x represents the range from which the random number will be generated. The y represents the number of randomly generated numbers. Setting replace to true makes sure that the same number can be generated again. It can be set to false if (cid:455)ou do(cid:374)(cid:859)t (cid:449)a(cid:374)t to ge(cid:374)erate the sa(cid:373)e ra(cid:374)do(cid:373) (cid:374)u(cid:373)(cid:271)er more than once.