That's true. In the same commit you had acgh-survival-test.R where additional handling for variable survival was added. So I was just confused if something needs to be done in other scripts also. And too lazy to read through the R documentation to find out myself. :)

________________________________________
From: Ilari Scheinin [notifications@github.com]
Sent: Friday, April 05, 2013 3:24 PM
To: chipster/chipster
Cc: Aleksi Kallio
Subject: Re: [chipster] Bugfix for copy number tools (#4)

In src/main/modules/common/R-2.15/acgh-plot-survival.R:

>
>  library(survival)
>
>  file <- 'survival-test.tsv'
>  dat <- read.table(file, header=TRUE, sep='\t', quote='', row.names=1, as.is=TRUE, check.names=FALSE)
> -phenodata <- read.table('phenodata.tsv', header=TRUE, sep='\t')
> +phenodata <- read.table('phenodata.tsv', header=TRUE, sep='\t', check.names=FALSE)
>
>  s <- Surv(phenodata[,survival], phenodata[,status])


When the read.table command does not have check.names set to FALSE, the resulting data.frame will call "column name with spaces" "column.name.with.spaces", and phenodata[,survival] will not work. With check.names=FALSE, the column name will stay "column name with spaces", and it will work.

check.names: logical.  If ‘TRUE’ then the names of the variables in the
          data frame are checked to ensure that they are syntactically
          valid variable names.  If necessary they are adjusted (by
          ‘make.names’) so that they are, and also to ensure that there
          are no duplicates.


Column names do not need to be "syntactically valid variable names", so both of these works fine:

phenodata$"column name with spaces"
column <- "column name with spaces"
phenodata[,column]


But when the name is valid, this can also be used without the quotes:

phenodata$column.name.without.spaces


Another way to fix this would be to run:

survival <- make.names(survival)


This would cause "column name with spaces" to be converted to "column.name.with.spaces", again matching the name of the column in the data.frame.

—
Reply to this email directly or view it on GitHub<https://github.com/chipster/chipster/pull/4/files#r3671942>.