title: Editing the output of a R Summary Function
body: <p>The output of my R summary function is generating tabular data in which some of the cells have values like :</p>
  
  <p>"Max. 12312"
  "Min. 123123"
  "Mean ....."</p>
  
  <p>etc. </p>
  
  <p>I would like to remove the part containing "Max." , "Min." etc as the labeling of this data is already taken care of in the first column of the table.</p>
  
  <p>So I wrote a for loop (yes I know for loops to be avoided - but before writing efficient code, I am trying to get the algorithm right here )</p>
  
  <pre><code>columnNames&lt;-colnames(sum_dframe)
    for(i in 1:length(columnNames))
    {
      varColData&lt;-sum_dframe[,i]
  
      if(grepl("Alpha-Numeric",sug_dtype[i],fixed = TRUE) !=TRUE) #not an alpha-numeric type column i.e its a numeric type
      {
        for(j in 1:length(varColData))
        {
          if(!is.na(varColData[j]))
          {
            varCellData&lt;-varColData[j]
  
             if(grepl("Max.",varCellData)==TRUE)
               varCellData&lt;-gsub("Max.","",varCellData,fixed = TRUE)
             if(grepl("Min",varCellData)==TRUE)
               varCellData&lt;-gsub("Min.","",varCellData,fixed = TRUE)
             if(grepl("Median",varCellData)==TRUE)
               varCellData&lt;-gsub("Median","",varCellData,fixed = TRUE)
             if(grepl("Mean",varCellData)==TRUE)
               varCellData&lt;-gsub("Mean","",varCellData,fixed = TRUE)
             if(grepl("1st Qu.",varCellData)==TRUE)
               varCellData&lt;-gsub("1st Qu.","",varCellData,fixed = TRUE)
             if(grepl("3rd Qu.",varCellData)==TRUE)
               varCellData&lt;-gsub("3rd Qu.","",varCellData,fixed = TRUE)
             if(grepl(":",varCellData)==TRUE)
               varCellData&lt;-gsub(":","",varCellData,fixed = TRUE)
  
             varColData[j]&lt;-varCellData
          }
        }
      }
      else if(grepl("Alpha-Numeric",sug_dtype[i],fixed = TRUE) ==TRUE) #alpha-numeric type column
      {
        sum_dframe[,i]&lt;-NULL #blank the cell
      }
    }
  </code></pre>
  
  <p>But I am unable to edit the cell values - seems like R doesn't allow me to change the values of the "Factor" once its generated. </p>
  
  <p>The error thrown is : </p>
  
  <p><strong>Warning in <code>[&lt;-.factor</code>(<code>*tmp*</code>, j, value = "   :1  ") :
    invalid factor level, NA generated</strong></p>
  
  <p>How to make this editable ? </p>