<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; "><div class="MsoNormal"><span lang="EN-US" style="font-size: 13.5pt; font-family: 'Times New Roman', serif; ">Hi R users:<o:p></o:p></span></div>
<div class="MsoNormal"><span lang="EN-US" style="font-size: 13.5pt; font-family: 'Times New Roman', serif; "><o:p> </o:p></span></div>
<div class="MsoNormal"><span lang="EN-US" style="font-size: 13.5pt; font-family: 'Times New Roman', serif; ">I am trying some functions in QRMlib
package and applying to my own trial dataset but encountered the following
error message when dealing with time series data. <o:p></o:p></span></div>
<div class="MsoNormal"><span lang="EN-US" style="font-size: 13.5pt; font-family: 'Times New Roman', serif; "><o:p> </o:p></span></div>
<div class="MsoNormal"><span lang="EN-US" style="font-size: 13.5pt; font-family: 'Times New Roman', serif; ">Error in
midnightStandard(charvec, format) : <o:p></o:p></span></div>
<div class="MsoNormal"><span lang="EN-US" style="font-size: 13.5pt; font-family: 'Times New Roman', serif; "> 'charvec' has non-NA entries of different
number of characters<o:p></o:p></span></div>
<div class="MsoNormal"><span lang="EN-US" style="font-size: 13.5pt; font-family: 'Times New Roman', serif; "><br>
<!--[if !supportLineBreakNewLine]--><br>
<!--[endif]--><o:p></o:p></span></div>
<div class="MsoNormal"><span lang="EN-US" style="font-size: 13.5pt; font-family: 'Times New Roman', serif; ">I have googled
for some solution but the discussions are not clear enough to me if the issue
can be solved or not. I suppose it is due to the data type conflict.<o:p></o:p></span></div>
<div class="MsoNormal"><span lang="EN-US" style="font-size: 13.5pt; font-family: 'Times New Roman', serif; "><br>
Listed below is the coding and dataset is attached:<o:p></o:p></span></div>
<div class="MsoNormal"><span lang="EN-US" style="font-size: 13.5pt; font-family: 'Times New Roman', serif; ">dataset <-
read.csv("D:/stockindex.csv", header=TRUE, sep = ",");<o:p></o:p></span></div>
<div class="MsoNormal"><span lang="EN-US" style="font-size: 13.5pt; font-family: 'Times New Roman', serif; ">tsData <-
as.timeSeries(dataset);<o:p></o:p></span></div>
<div class="MsoNormal"><span lang="EN-US" style="font-size: 13.5pt; font-family: 'Times New Roman', serif; ">Date <-
tsData[,1];<o:p></o:p></span></div>
<div class="MsoNormal"><span lang="EN-US" style="font-size: 13.5pt; font-family: 'Times New Roman', serif; ">SP500ts <-
tsData[,2];<br>
<!--[if !supportLineBreakNewLine]--><br>
<!--[endif]--><o:p></o:p></span></div>
<div class="MsoNormal"><span lang="EN-US" style="font-size: 13.5pt; font-family: 'Times New Roman', serif; ">SP500.nreturns
<- -mk.returns(SP500ts);<o:p></o:p></span></div>
<div class="MsoNormal"><span lang="EN-US" style="font-size: 13.5pt; font-family: 'Times New Roman', serif; ">tD <-
timeDate("05/16/1992","%m/%d/%Y");<o:p></o:p></span></div>
<div class="MsoNormal"><span lang="EN-US" style="font-size: 13.5pt; font-family: 'Times New Roman', serif; ">window <-
(seriesPositions(SP500.nreturns) > tD);<o:p></o:p></span></div>
<span lang="EN-US" style="font-size: 13.5pt; font-family: 'Times New Roman', serif; ">SP500.nreturns <-
SP500.nreturns[window];</span><br></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; "><span lang="EN-US" style="font-size: 13.5pt; font-family: 'Times New Roman', serif; "><br></span></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; "><span lang="EN-US" style="font-size: 13.5pt; font-family: 'Times New Roman', serif; ">Thanks for your attention and assistance.</span></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; "><span lang="EN-US" style="font-size: 13.5pt; font-family: 'Times New Roman', serif; "><br></span></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; "><span lang="EN-US" style="font-size: 13.5pt; font-family: 'Times New Roman', serif; ">Wei-han</span></div></div></body></html>