[R] Deleting observations - can't see the data after that

jim holtman jholtman at gmail.com
Thu Oct 7 23:43:15 CEST 2010


Can you give a reproducible sample of data.  Exactly what commands are
you executing when it doesn't print?  What does 'str(data)' show?

This works fine for me:

> x <- data.frame(a=1:5, b=1:5)
> x
  a b
1 1 1
2 2 2
3 3 3
4 4 4
5 5 5
> x <- x[-3,]
> x
  a b
1 1 1
2 2 2
4 4 4
5 5 5
> str(x)
'data.frame':   4 obs. of  2 variables:
 $ a: int  1 2 4 5
 $ b: int  1 2 4 5
>


On Thu, Oct 7, 2010 at 5:30 PM, Schwab,Wilhelm K <bschwab at anest.ufl.edu> wrote:
> Hello all,
>
> I am loading a data frame, fitting a model, getting diagnostic plots and they are flagging a couple of observations as problematic.  Fair enough, and I want re-fit without them.
>
> After I delete an offending row (identified by one of the diagnostic plots), something like
>
>    data = data[-3,];
>
> then R will no longer print the contents of the data frame; it tells me it is a data frame with specific (correct) number of rows and columns, but won't show me what remains in the frame like it does before the deletion.  Is there a way to get around that, either using a different deletion technique or another function?  print(data) and show(data) are not helping.
>
> Ultimately,  I am trying to go through a couple of iterations of find pathologic points, delete and re-fit.  In this case I could guess at what is wrong and probably be correct, but I want to follow the clues as a learning exercise.  Once that is complete, I plan to plot everything with the deleted points emphasized.
>
> Bill
>
> ______________________________________________
> 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.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?



More information about the R-help mailing list