horsePrices <- read.csv(“https://raw.github.com/vincentarelbundock/Rdatasets/master/csv/Stat2Data/HorsePrices.csv”, header = TRUE)
summary(horsePrices) mean(horsePrices\(Price) mean(horsePrices\)Age) median(horsePrices\(Price) median(horsePrices\)Age)
oldHorse <- subset(horsePrices,Age>=8,select=c(HorseID,Price,Age,Sex))
colnames(oldHorse)[4] <- “Gender”
summary(oldHorse) mean(oldHorse\(Price) mean(oldHorse\)Age) median(horsePrices\(Age) median(horsePrices\)Height,na.rm = TRUE)
oldHorse <- within(oldHorse,Price[Gender==‘m’] <- Price*0.9)
oldHorse
horseCsv <- read.csv(“https://raw.githubusercontent.com/xiaoxiaogao-DD/String-Class/master/HorsePrices.csv”,header = TRUE) horseCsv summary(horseCsv)