I encountered this code from the Oncoprint supplementary code:
amp = ifelse(apply(mat, 1, function(x) sum(grepl("AMP", x))/length(x) > 0.1), "high AMP events", "low AMP events")
amp = factor(amp, levels = c("low AMP events", "high AMP events"))
Which is meant to split the genes into 2 groups based on the amplification rate across patients. The variable amp contains labels for genes indicating which group they are in. amp is converted to a factor to control the order of two row-slices on the plot.
Im trying to reformat it so that it can split the genes into good responders and poor responders, so its essentially 3 conditions where the genes involved with good responders, genes involved with poor responders and genes involved with both. (FYI, Good responders = 1, Poor responders = 3)
This is my attempt:
ifelse(apply(response_level, 1, function(x) sum(grep("1"&&"3", "Mixed, ifelse(apply(response_level, 1, function(x) sum(grepl("1", "Good 1", "Poor 3"))
> Error: unexpected numeric constant in "response_level = ifelse(apply(response_level, 1, function(x) sum(grep("1"&&"3", "Mixed, ifelse(apply(response_level, 1, function(x) sum(grepl("1"