These exercises accompany the Data Types tutorial.
Tip: you can use a ? in front of the function name to access the help documentation for any function (e.g. ?round)
round() function to round this number to 2 decimal places and to 0 decimal places. Use floor() and and ceiling() to trim obj4 to an integer and compare the output.data(winddata). View the first five lines of data. What is the name of the first column of data?read.csv() function to import the data into R. Save it as a data frame named ‘df1.’obj1 <- 15
log10(obj1)
## [1] 1.176091
obj2 <- 125
obj2 ^ 0.5
## [1] 11.18034
sqrt(obj2)
## [1] 11.18034
obj4 <- 55.4367
round(obj4, digits= 2)
## [1] 55.44
round(obj4, digits= 0)
## [1] 55
floor(obj4)
## [1] 55
ceiling(obj4)
## [1] 56
my.seq <- seq(1, 27, by= 3)
my.seq
## [1] 1 4 7 10 13 16 19 22 25
my.rep.seq <- rep(seq(1, 3, by= 1), 10)
my.rep.seq
## [1] 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
install.packages("bReeze")
# or use the Install button in RStudio and search for bReeze
library(bReeze) # load the bReeze package
data(winddata) # load the example dataset called 'winddata'
head(winddata) # Use head to view the first five lines of data, can view colnames as well
colnames(winddata) #First column name is date_time
df1 <- read.csv("E:/RIntro/datasets/so2_data.csv", header = TRUE, stringsAsFactors = FALSE)
colnames(df1) # Use colnames to view all the column names in this dataset
# "Date" "Hour" "SO2" "WNSP" "WNDR"
tail(df1) # Use the tail function to view the last 5 rows of data.
# Value is 0.006