[R] padding specific missing values with NA to allow cbind
Rob Forsyth
rob.forsyth at newcastle.ac.uk
Tue Jun 11 09:29:07 CEST 2013
Thanks very much
On 11 Jun 2013, at 4:59 am, William Dunlap wrote:
> Try adding the argument
> na.action = na.exclude
> to your call to lm(). See help("na.exclude") for details.
>
> Bill Dunlap
> Spotfire, TIBCO Software
> wdunlap tibco.com
>
>
>> -----Original Message-----
>> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf
>> Of Rob Forsyth
>> Sent: Monday, June 10, 2013 2:42 PM
>> To: r-help at r-project.org
>> Subject: [R] padding specific missing values with NA to allow cbind
>>
>> Dear list
>>
>> Getting very frustrated with this simple-looking problem
>>
>>> m1 <- lm(x~y, data=mydata)
>>> outliers <- abs(stdres(m1))>2
>>> plot(x~y, data=mydata)
>>
>> I would like to plot a simple x,y scatter plot with labels giving custom information
>> displayed for the outliers only, i.e. I would like to define a column mydata$labels for the
>> mydata dataframe so that the command
>>
>>> text(mydata$y, mydata$x, labels=mydata$labels)
>>
>> will label those rows where outliers[i] = TRUE with text but is otherwise blank
>>
>> The first problem I have is that due to some NAs in mydata, nrows(outliers) <
>> nrows(mydata) and I'm getting in a tangle trying to pad the appropriate rows of outliers
>>
>> Thanks
>>
>> Rob
>>
>> ______________________________________________
>> 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