[R] Filtering out rows

Bryan Mac bryanmac.24 at gmail.com
Wed Nov 2 17:48:54 CET 2016


Hi,

I am looking to filter out rows in my data set, run my analysis and
then removing the filter. Here is my regression. I would like to
filter out a row. For example, I would like to filter out a row,
"Case"=1511.

npi=lm(npi_mvmt~cnavgpi,data=df)
summary(npi)
resid.vs.fitt.LS%<a-%{plot(npi,1)}
resid.vs.fitt.LS

npi_lms=lmsreg(npi_mvmt~cnavgpi,data=df)
fitted.npi_lms<-fitted(npi_lms)
resid.npi_lms<-residuals(npi_lms)
resid.vs.fitt.LMS %<a-%{plot(fitted.npi_lms,resid.npi_lms);
title("npi_mvmt~cnavgpi")}
resid.vs.fitt.LMS

plot_cnavgpi_npi_mvmt %<a-%{plot(cnavgpi,npi_mvmt);
abline(lm(npi_mvmt~cnavgpi,data=df),lwd=2,col=2,lty=1);
abline(lmsreg(npi_mvmt~cnavgpi,data=df),lwd=2, col=3,lty=1);
legend('topright',c('OLS','LMS'),lty=c(1,1),lwd=c(2.5,2.5), col=c(2,3));
title (npi_mvmt~cnavgpi) }
plot_cnavgpi_npi_mvmt

Best,
Bryan Mac



More information about the R-help mailing list