Assignment:

Fixing the column names and then renaming the elements in four of the columns.

##Loading file:
mush<-read.table("https://archive.ics.uci.edu/ml/machine-learning-databases/mushroom/agaricus-lepiota.data",header = FALSE,sep = ",")
###renaming columns
colnames(mush)<-c("edibility","cap-shape","cap-surface","cap-color","bruises","odor","gill-attachment","gill-spacing","gill-size","gill-color","stalk-shape","stalk-root","stalk-surface-above-ring","stalk-surface-below-ring","stalk-color-above-ring","stalk-color-below-ring","veil-type","veil-color","ring-number","ring-type","spore-print-color","population","habitat")
#setting the columns as ordered factors so that I can then rename them without turning everything into strings
#I don't feel like ordering all 23 columns, writing a function to do it for me
orderme <- function(factcol){
  factcol<-factor(factcol, levels(factcol),ordered=TRUE)
  return(factcol)
}
##there's probably a neater and faster way to do this, but this works
for (i in 1:23) {
  mush[,i]<-orderme(mush[,i])
}
levels(mush$edibility)<-c("edible","poisonous")
levels(mush$`cap-shape`)<-c("bell","conical","flat","knobbed","sunken","convex")
levels(mush$`cap-surface`)<-c("fiborous","grooves","smooth","scaly")
levels(mush$odor)<-c("almond","creosote","foul","anise","musty","none","pungent","spicy","fishy")
summary(mush)
##      edibility      cap-shape      cap-surface     cap-color    bruises 
##  edible   :4208   bell   : 452   fiborous:2320   n      :2284   f:4748  
##  poisonous:3916   conical:   4   grooves :   4   g      :1840   t:3376  
##                   flat   :3152   smooth  :2556   e      :1500           
##                   knobbed: 828   scaly   :3244   y      :1072           
##                   sunken :  32                   w      :1040           
##                   convex :3656                   b      : 168           
##                                                  (Other): 220           
##       odor      gill-attachment gill-spacing gill-size   gill-color  
##  none   :3528   a: 210          c:6812       b:5612    b      :1728  
##  foul   :2160   f:7914          w:1312       n:2512    p      :1492  
##  spicy  : 576                                          w      :1202  
##  fishy  : 576                                          n      :1048  
##  almond : 400                                          g      : 752  
##  anise  : 400                                          h      : 732  
##  (Other): 484                                          (Other):1170  
##  stalk-shape stalk-root stalk-surface-above-ring stalk-surface-below-ring
##  e:3516      ?:2480     f: 552                   f: 600                  
##  t:4608      b:3776     k:2372                   k:2304                  
##              c: 556     s:5176                   s:4936                  
##              e:1120     y:  24                   y: 284                  
##              r: 192                                                      
##                                                                          
##                                                                          
##  stalk-color-above-ring stalk-color-below-ring veil-type veil-color
##  w      :4464           w      :4384           p:8124    n:  96    
##  p      :1872           p      :1872                     o:  96    
##  g      : 576           g      : 576                     w:7924    
##  n      : 448           n      : 512                     y:   8    
##  b      : 432           b      : 432                               
##  o      : 192           o      : 192                               
##  (Other): 140           (Other): 156                               
##  ring-number ring-type spore-print-color population habitat 
##  n:  36      e:2776    w      :2388      a: 384     d:3148  
##  o:7488      f:  48    n      :1968      c: 340     g:2148  
##  t: 600      l:1296    k      :1872      n: 400     l: 832  
##              n:  36    h      :1632      s:1248     m: 292  
##              p:3968    r      :  72      v:4040     p:1144  
##                        b      :  48      y:1712     u: 368  
##                        (Other): 144                 w: 192