[R] Putting referenced titles on plots

grr@grell.mailshell.com grr at grell.mailshell.com
Mon May 31 21:18:34 CEST 2004


Yes! Thank you. It is a factor (I don't know how it became a factor). I 
created an array based on the 'names' factor, and can get the titles by 
referencing the new array.

Thanks so much,

Graham

On May 31, 2004, at 11:44 AM, Roger D. Peng wrote:

> Is `names' by any chance a factor?  What is class(names)?  If `names' 
> is a factor, then you're getting the underlying numeric representation 
> rather than the factor levels.
>
> -roger
>
> grr at grell.mailshell.com wrote:
>
>> I have a data frame "ctx" and an array "names", where names[i] is the 
>> column name for ctx[i], and am making histograms for each column of 
>> ctx:
>> for (i in 2:ncol(ctx)){hist(ctx[,i], br=100, main=names[i])}
>> The titles don't come out like I expect. Each names[i] is something 
>> like "1098_s_at" and R doesn't seem to like printing these. Instead, 
>> it prints "1" or "2" or "3" etc.
>> I have also tried binding ctx and names into a single data frame and 
>> referencing the first row of each [i] as the title, but I get the 
>> same result.
>> Can someone tell me how to get these titles attached?
>> Thanks,
>> Graham
>> ______________________________________________
>> R-help at stat.math.ethz.ch mailing list
>> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide! 
>> http://rd.mailshell.com/www.R-project.org/posting-guide.html
>




More information about the R-help mailing list