[BioC] replace a value in a matrix using index

Sean Davis sdavis2 at mail.nih.gov
Tue Oct 2 15:52:12 CEST 2012


On Mon, Oct 1, 2012 at 8:17 PM, Mark B <mablfm at gmail.com> wrote:
> Hi,
> I am trying to replace a single numeric value in a matrix with a character
> vector.
>
>>mat[5580, 4]
> [1] 838.1
>
>> mat.r <- replace(mat, mat[5580, 4], "NA")

mat[5580,4]=NA

Note that matrices can contain only one type, so you will not be able
to put in a character value without your whole matrix being coerced to
character (probably not what you want).

Hope that helps.

Sean


> I don't get any errors. However when I go to see if the number at mat[5580,
> 4] was replaced with "NA"
> the old number is still there. I don't get any errors.
>
>>mat.r[5580, 4]
> [1] 838.1
>
> Any hints on how to do this?
> Thanks,
>
> MAB
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at r-project.org
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor



More information about the Bioconductor mailing list