Skip to content

Question about levels/as.numeric

7 messages · Peter Ehlers, Rolf Turner, Thibault Vatter +2 more

#
On Sun, Apr 10, 2011 at 05:47:59PM +0200, Thibault Vatter wrote:
Hi.

It seems that the first file contains a non-numeric row. It may contain "C",
which is the last of the levels. In this case, the whole column is
considered as a character vector and is converted to a factor.
These are indices to the levels of the factor.

Petr Savicky.
#
Thibault,

Your questions indicate that you would benefit enormously
from reading 'An Introduction to R'.

A very useful function is str().
Understanding the concept of "factors" is crucial in R.

"Checking" anything with Excel is never much use.

Peter Ehlers
On 2011-04-10 08:47, Thibault Vatter wrote:
#
On 11/04/11 10:08, Peter Ehlers wrote:
<SNIP>
<SNIP>

Fortune?

     cheers,

         Rolf Turner
#
On Sun, Apr 10, 2011 at 05:47:59PM +0200, Thibault Vatter wrote:
There is probably a non-numeric row in the data. In order to locate this
row, try the following

  which(is.na(as.numeric(as.character(returns[, 1]))))

This will show the indices of the rows, which cannot be converted
to numeric type.

Petr Savicky.
#
--- On Sun, 4/10/11, Rolf Turner <rolf.turner at xtra.co.nz> wrote:

            
Definitely!