[Bioc-devel] Weird problem: invalid internal conversion?

Martin Morgan mtmorgan at fhcrc.org
Mon May 24 00:08:25 CEST 2010


On 05/23/2010 02:52 PM, Groot, Philip de wrote:
> Hello all,
> 
> I bumped upon the following weird problem:
> 
>> coords <- rbind(c("-7.27996304796776", "-0.318763179006429"),
> +                 c("-5.32491457041437", "0.0899675866959967"),
> +                 c("-1.59446413449287", "-0.0537973666317704"),
> +                 c("-4.07009809428656", "-0.311306729381296"),
> +                 c("1.4145619288123", "0.212680197703627"))
>> rownames(coords) <- c("A", "B", "C", "D", "E")
>> colnames(coords) <- c("x", "y")
>>
>> Clusters <- as.factor(c(21, 18, 9, 23, 24))
>>
>> cbind(coords, Clusters)
>   x                   y                     Clusters
> A "-7.27996304796776" "-0.318763179006429"  "3"
> B "-5.32491457041437" "0.0899675866959967"  "2"
> C "-1.59446413449287" "-0.0537973666317704" "1"
> D "-4.07009809428656" "-0.311306729381296"  "4"
> E "1.4145619288123"   "0.212680197703627"   "5"
>> sessionInfo()
> R version 2.11.0 (2010-04-22)
> x86_64-unknown-linux-gnu
> locale:
>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
>  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
>  [5] LC_MONETARY=C              LC_MESSAGES=en_US.UTF-8
>  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
>  [9] LC_ADDRESS=C               LC_TELEPHONE=C
> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>>
> 
> The column "Clusters" does not contain the numbers that I expect!
> Instead, it contains the references to levels(Clusters)! I don't
> understand the reason. What do I miss here? Please note that this
> "feature" is at least present in R-2.10 and R-2.11 in both Windows
> and Linux. And yes: it is reproducible!

from ?cbind,

     Any classes the inputs
     might have are discarded (in particular, factors are replaced by
     their internal codes).

so it's weird but as documented. Probably an R-help question.

Martin



> 
> Regards,
> 
> Dr. Philip de Groot Ph.D.
> Bioinformatics Researcher
> 
> Wageningen University / TIFN
> Nutrigenomics Consortium
> Nutrition, Metabolism & Genomics Group
> Division of Human Nutrition
> PO Box 8129, 6700 EV Wageningen
> Visiting Address: Erfelijkheidsleer: De Valk, Building 304
> Dreijenweg 2, 6703 HA  Wageningen
> Room: 0052a
> T: +31-317-485786
> F: +31-317-483342
> E-mail:   Philip.deGroot at wur.nl<mailto:Philip.deGroot at wur.nl>
> Internet: http://www.nutrigenomicsconsortium.nl<http://www.nutrigenomicsconsortium.nl/>
>              http://humannutrition.wur.nl/
>              https://madmax.bioinformatics.nl/
> 
> _______________________________________________
> Bioc-devel at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/bioc-devel


-- 
Martin Morgan
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M1 B861
Phone: (206) 667-2793



More information about the Bioc-devel mailing list