[R] plot only non-zero values

Uwe Ligges ligges at statistik.tu-dortmund.de
Sun Mar 18 17:49:28 CET 2012



On 17.03.2012 10:19, Joshua Wiley wrote:
> What about just setting them to missing and plotting?
>
> md<- yourdata
> md[md==0]<- NA
>
> My other idea depending how you want the plot to look would be to try something where 0 values get a blank colour or null plotting value



Or the OP is going to just ignore such data and want to plot na.omit(md) 
after you had set all 0 to NA.

Uwe



>
> On Mar 16, 2012, at 22:53, Noah Silverman<noahsilverman at ucla.edu>  wrote:
>
>> Hi,
>>
>> i have some data in a matrix.  It has zero values scattered throughout, at random.
>>
>> I'd like to create a line plot, with a line for each row, that *excludes* the zero or NA values.
>>
>> The data looks like this (toy example)
>>
>> 10 12 21 0 23 0 43 0 NA 41
>> 0 0 0 34 35 0 35 0 44 0
>> NA NA NA 3 2 5 0 3 2
>> etc...
>>
>> Suggestions on an easy way to do this?
>>
>> Thanks!
>>
>> --
>> Noah Silverman
>> UCLA Department of Statistics
>> 8208 Math Sciences Building
>> Los Angeles, CA 90095
>>
>>
>>     [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list