Hola,

Obtienes un error por que no indicas el "origin", tal y como refleja
fielmente la documentación:

> as.Date(as.numeric(Sys.time()))Error in 
> as.Date.numeric(as.numeric(Sys.time())) :
  'origin' must be supplied



---------------------------------------------------------------------
Details

The usual vector re-cycling rules are applied to x and format so the answer
will be of length that of the longer of the vectors.

Locale-specific conversions to and from character strings are used where
appropriate and available. This affects the names of the days and months.

The as.Date methods accept character strings, factors, logical NA and
objects of classes "POSIXlt
<http://127.0.0.1:42870/help/library/base/help/POSIXlt>" and "POSIXct
<http://127.0.0.1:42870/help/library/base/help/POSIXct>". (The last is
converted to days by ignoring the time after midnight in the representation
of the time in specified time zone, default UTC.) Also objects of class
"date"(from package date
<http://127.0.0.1:42870/help/library/date/html/as.date.html>) and "dates" (from
package chron <http://127.0.0.1:42870/help/library/chron/html/chron.html>).
Character strings are processed as far as necessary for the format
specified: any trailing characters are ignored.

*as.Date will accept numeric data (the number of days since an epoch),
but only if origin is supplied.*

The format and as.character methods ignore any fractional part of the date.
---------------------------------------------------------------------

Saludos,
Carlos Ortega
www.qualityexcellence.es





El 9 de julio de 2014, 14:25, Alberto Soria <[email protected]>
escribió:

> Hola a todos:
>
> Debe de ser una tontería, pero no consigo saber porque la siguiente linea
> no devuelve la fecha actual:
>
> as.Date(as.numeric(Sys.time()))
>
> He hecho esa prueba porque no consigo pasar un numero convertido a partir
> de una fecha y modificado a fecha de nuevo.
>
> Gracias por adelantado.
>
> Un saludo,
> Alberto.
>
>         [[alternative HTML version deleted]]
>
>
> _______________________________________________
> R-help-es mailing list
> [email protected]
> https://stat.ethz.ch/mailman/listinfo/r-help-es
>
>


-- 
Saludos,
Carlos Ortega
www.qualityexcellence.es

        [[alternative HTML version deleted]]

_______________________________________________
R-help-es mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-help-es

Responder a