Advertisement
Guest User

Rstudio

a guest
Sep 19th, 2019
307
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. #when given a excel file
  2. #data<-read.csv("filename.csv",header=TRUE)
  3. #clear console ctrl+l
  4.  
  5. #Lab class 7
  6.  
  7. #1
  8. setwd("C:\\Users\\IT18100662\\Desktop\\LAB CLASS 07-20190910")
  9. getwd()
  10. data<-read.table('Forest.txt',header = TRUE, sep = ",")
  11. #display data
  12. fix(data)
  13. attach(data)
  14.  
  15.  
  16. #2 summery/structure of the dataset
  17. str(data)
  18.  
  19. #3
  20. #517 obs means 517 rows
  21.  
  22. #4
  23. min(wind)
  24. max(wind)
  25.  
  26. #5 Five number summery
  27. summary(temp)
  28.  
  29. #6 to get Outliers - create a boxplot
  30. boxplot(wind,horizontal = TRUE,pch=3)
  31. #normal distribution, if median band in left-> tail goes right then positive dist.
  32. #if median band in right-> negative dist
  33.  
  34. #7Negative distibutuon
  35.  
  36. #8median of temp
  37. median(temp)
  38.  
  39. #9
  40. mean(wind)
  41. sd(wind) #standard deviation
  42.  
  43. #sapply gives all x of every column
  44. #sapply(data,x)
  45. sapply(data,sd)
  46.  
  47. #10 interpartile = q3-q1
  48. IQR(wind)
  49.  
  50. #11 get freq table
  51. freq<-table(day,month)
  52. freq
  53.  
  54. #12 average= mean
  55. mean(temp[month=="sep"])
  56.  
  57. #13
  58. barplot(freq,beside = TRUE,xlab = "Month",ylab = "Frequency",legend=rownames(freq))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement