Dear,
Thanks for the previous tips about 'its' for importing the following
data.
5/10/1998,7
5/11/1998,5
5/12/1998,2
5/14/1998,1
5/15/1998,1
5/19/1998,1
5/20/1998,1
1. When using the following command;
test<-readcsvIts('Fires98.csv',informat=its.format("%m/%d/%Y"),header=FA
LSE)
the function reads in the data from the csv file as;
V2
05/10/1998 7
05/11/1998 5
When testing if it's a its object
is.its(test)
the result is FALSE.
When do you use informat or outformat?
What goes wrong?
2. When reading in the data as a table;
m1 <- read.table('Fires98.csv',header=FALSE, sep=",",
dec=".")
V1 V2
1 5/10/1998 7
2 5/11/1998 5
...
test2 <- its(m1,dates=as.POSIXct(x=strptime(dimnames(V1)[[1]]
format=its.format("%m/%d/%Y"))) )...Doesn't work!
I have difficulties defining the first V1 column as its object.
Thanks in advance for helping me out,
Jan
________________________________________________________________________
__
Jan Verbesselt
Research Associate
Lab of Geomatics and Forest Engineering K.U. Leuven
Vital Decosterstraat 102. B-3000 Leuven Belgium
Tel:+32-16-329750
Fax: +32-16-329760
http://perswww.kuleuven.ac.be/~u0027178/VCard/mycard.php?name=janv
http://gloveg.kuleuven.ac.be/
________________________________________________________________________
__
Jan
The function readcsvIts reads a csv file into a matrix. To convert
the matrix into an 'its', apply the its function to the matrix.
So for your example
its.format("%m/%d/%Y")
test? <- its(readcsvIts(filename))
is.its(test)
"TRUE"
The its documentation for readcsvIts states incorrectly that an 'its'
object is returned, so your confusion is understandable. I will correct
this in the next release.
Giles
> -----Original Message-----
> From: Jan Verbesselt [mailto:Jan.Verbesselt at agr.kuleuven.ac.be]
> Sent: 01 September 2003 15:00
> To: r-help at stat.math.ethz.ch
> Subject: [R] readcsvIts() to create irregular time series
>
>
> Dear,
>
> Thanks for the previous tips about 'its' for importing the
following
> data.
> 5/10/1998,7
> 5/11/1998,5
> 5/12/1998,2
> 5/14/1998,1
> 5/15/1998,1
> 5/19/1998,1
> 5/20/1998,1
>
> 1. When using the following command;
>
test<-readcsvIts('Fires98.csv',informat=its.format("%m/%d/%Y")
> ,header=FA
> LSE)
>
> the function reads in the data from the csv file as;
> V2
> 05/10/1998 7
> 05/11/1998 5
>
> When testing if it's a its object
> is.its(test)
> the result is FALSE.
> When do you use informat or outformat?
> What goes wrong?
>
> 2. When reading in the data as a table;
> m1 <- read.table('Fires98.csv',header=FALSE, sep=",",
dec=".")
> V1 V2
> 1 5/10/1998 7
> 2 5/11/1998 5
> ...
> test2 <- its(m1,dates=as.POSIXct(x=strptime(dimnames(V1)[[1]]
> format=its.format("%m/%d/%Y"))) )...Doesn't work!
>
> I have difficulties defining the first V1 column as its object.
>
> Thanks in advance for helping me out,
> Jan
>
>
>
> ______________________________________________________________
> __________
> __
> Jan Verbesselt
> Research Associate
> Lab of Geomatics and Forest Engineering K.U. Leuven
> Vital Decosterstraat 102. B-3000 Leuven Belgium
> Tel:+32-16-329750
> Fax: +32-16-329760
> http://perswww.kuleuven.ac.be/~u0027178/VCard/mycard.php?name=janv
> http://gloveg.kuleuven.ac.be/
> ______________________________________________________________
> __________
> __
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>
**********************************************************************
This is a commercial communication from Commerzbank AG.\ \ T...{{dropped}}
> BUT; > 1. What can you do with informat and outformat? Is it the same as > its.format() before the its function?its.format() sets the text representation format for the times, and once set, it persists within that R session. It is often convenient to set this format just once in a session, since in many circumstances multiple date formats serve only to distract and confuse. The arguments informat and outformat in readcsvIts override the value set in its.format().> > 2. Can the its be plotted onto a ts? And is a correlation analysis in > between the two objects possible? >All regular time-series can be represented as irregular time-series - they are a special case. If you want to use both, I suggest you convert your regular time-series to irregular. You might for example use seq.POSIXt(start,end,by="month") to set up a monthly series of POSIX dates, and its(matrix,seq.POSIXt(start,end,by="month")) will then provide you with a reglar time-series reprented as an 'its'. Having done this, you can plot multiple series, which may not have the same time-stamps, using for example: xy <- unionIts(Fire,its(matrix,seq.POSIXt(start,end,by="month")) plot(xy)> 2. Can the its be plotted onto a ts? And is a correlation analysis in > between the two objects possible?A meaningful calculation of correlation normally requires the data to be aligned in time (I can't think of an exception to this). So you need to ensure that you have at least some of the data 'aligned' to start off with. For example, if you have an 'its' x with daily data, and a 'its' y with monthly data, you could do the following: cor(intersectIts(x,y)) It relies for success on at least some subset of the POSIX dates being equal, i.e. that the result of the intersect operation is not NULL. Giles ********************************************************************** This is a commercial communication from Commerzbank AG.\ \ T...{{dropped}}