1

When I did

reg <- lm(X4 ~., data = donnees.train)

Why did I see this error?

# Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) : 
#  0 (non-NA) cases

My csv file has 12 column X1,X2,....,X12 numeric values for input and one column Y1 for output.

Zheyuan Li
  • 71,365
  • 17
  • 180
  • 248
user3235052
  • 41
  • 2
  • 8
  • Please include output of `head(donnees.train)`. It seems you have a column filled with `NA` values. – jbaums Feb 22 '14 at 20:53
  • My Output column : Y1 400 840 17180 181 434 708 15540 122 448 1020 11530 508 453 756 7800 411 571 513 1313 379 761 655 8590 480 – user3235052 Feb 22 '14 at 20:54
  • I am skeptical that this is the output of `head(donnees.train)`. The `lm` function is expecting `donnees.train` to include one element named `X4`, and at least one other element. Here you've just given me your `Y1` vector. Run `head(donnees.train)` and then edit your post and paste in the output. – jbaums Feb 22 '14 at 20:58
  • I run the code you told ; head(donnees.train) [1] X2 X3 X4 <0 rows> (or 0-length row.names) Sorry my English is not good and my answers may not be correct to you. – user3235052 Feb 22 '14 at 21:03
  • 2
    `0 rows` indicates that `donnees.train` contains no data. You've made a mistake somewhere with your subsetting and are trying to fit a model without any data. – jbaums Feb 22 '14 at 21:04
  • So the problem is with my csv file? – user3235052 Feb 22 '14 at 21:13
  • Perhaps, but based on your [other question](http://stackoverflow.com/questions/21959690/how-can-i-change-my-r-code-to-run-my-new-csv-file-data#comment33273245_21959690), I think it's more likely that you've done something wrong when you subset `donnees` to create `donnees.train`. Read the information at `?'['`. – jbaums Feb 22 '14 at 21:31

0 Answers0