Saving dates in a matrix ("origin must be supplied") with r -


i writing bachelor thesis , have not experience r far. problem dates made commands :

t<-strptime(x, "%d.%m.%y %h.%m")  

don't work anymore when save them in matrix other information on specific dates.

i bit confused because works fine when don't put them in matrix t[1:10]

but happens try save them in matrix

matrix1<-matrix(c(t,v2,v3,v4),nrow=length(v2))  fehler in as.posixct.numeric(x[[i]], ...) : 'origin' muss angegeben werden 

it's german means origin must supplied.

any ideas have fix it? bit frustrated :)

roland right. can't have posixlt objects in matrix. can save dates numeric timestamps in matrix , convert them dates while accessing converting numeric timestamp:

>date<- as.numeric(as.posixct("2014-02-16 2:13:46 utc",origin="01-01-1970")) >date [1] 1392545626 

then save timestamps in matrix , convert date, use above command again without converting numeric.


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -