SHARE
TWEET

07

crhunter Sep 19th, 2019 (edited) 92 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #LAB 07
  2.  
  3. #importing text .txt file
  4. #to see the current path
  5. getwd()
  6. #first set path to the exact folder
  7. setwd('C:\\Users\\cr\\Desktop\\LAB07')
  8. data<-read.table('Forest.txt',header = TRUE,sep = ",")
  9. # ctrl+l for clear the terminal
  10. attach(data)
  11. fix(data)
  12.  
  13. #close the data widow before execute anymore commands
  14.  
  15. #q2)
  16. str(data)
  17. #q3)
  18. #ANSWER - 517 Observations(number of rows in the dataset)
  19.  
  20. #q4)
  21. min(wind)
  22. max(wind)
  23.  
  24. #q5)
  25. summary(temp)
  26.  
  27. #q6)
  28. #to simply find the out liers ou can create a bloxplot
  29. boxplot(wind,horizontal = TRUE,outline = TRUE,pch=16)
  30. #pch is for the symbol (star, circle, traingle)
  31. #this is a negative distribution.
  32. #you can see midle line of the boxplot is close to the right side margin of the bloxplot
  33. #if it close to the left side it will called as Positive distribtion
  34. #if it lie on the center , called normal distribution
  35.  
  36. #q08)
  37. median(temp)
  38.  
  39. #09)
  40. mean(wind)
  41. sd(wind)
  42. #to get value for the whole data set at once.
  43. #second parameter is anything Etc: sd,mean,median
  44. sapply(data,sd)
  45. #10)
  46. # interqurtile means: q3-q1
  47. IQR(wind)
  48.  
  49. #11)
  50. #in this we have to have consern two colomns to get the answer
  51. freq<-table(day,month)
  52. freq
  53. #from this view you can find out the observation count
  54. #ANSWER - 21
  55.  
  56. #12)
  57. mean(temp[month=='sep'])
  58.  
  59. #13)
  60. freq
  61. #ANSWER: saturday
  62. #you can refer the previous table we have created.
  63. barplot(freq,beside = TRUE,xlab = "month",ylab = "frequncy",legend=rownames(freq))
  64. #using beside true -> you will get a separate bar for each and every day.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top