0

I'm currently working on a script which will eventually plot the accumulation of losses from cell divisions. Firstly I generate a matrix of values and then I add the number of times 0 occurs in each column - a 0 represents a loss.

However, I am now thinking that a nice plot would be a degradation curve. So, given the following example;

>losses_plot_data <- melt(full_losses_data, id=c("Divisions", "Accuracy"), value.name = "Losses", variable.name = "Size")
> full_losses_data
   Divisions Accuracy 20 15 10  5  2
           1        0  0  0  0  3 25
           2        0  0  0  1 10 39
           3        0  0  1  3 17 48
           4        0  0  1  5 23 55
           5        0  1  3  8 29 60
           6        0  1  4 11 34 64
           7        0  2  5 13 38 67
           8        0  3  7 16 42 70
           9        0  4  9 19 45 72
          10        0  5 11 22 48 74

Is there a way I can easily turn this table into being 100 minus the numbers shown in the table? If I can plot that data instead of my current data, I would have a lovely curve of degradation from 100% down to however many cells have been lost.

Richard Chambers
  • 16,643
  • 4
  • 81
  • 106
Jordan
  • 131
  • 8
  • Not clear about the expected output. Do you need `full_losses_data[,3:ncol(full_losses_data)] <- 100-full_losses_data[,3:ncol(full_losses_data)]` – akrun Oct 24 '15 at 19:45
  • 1
    This is correct yes, thank you - I'm just now finding some fluctuations in the numbers, not yet sure where they're coming from but I'll try and investigate. Essentially, before it was a nice smooth increase in number, so I was expecting this to be a smooth decrease from 100, but actually there seems to be some up-and-down – Jordan Oct 24 '15 at 19:53

1 Answers1

1

Assuming you do not want to do that for the first column:

fld <- full_losses_data
fld[, 2:ncol(fld)] <- 100 - fld[, -1] 
Robert Hijmans
  • 40,301
  • 4
  • 55
  • 63