Hi,<div><br></div><div>I have a timeseries in a csv file that I want to read into an xts object.</div><div><br></div><div>The csv file looks like:</div><div><div><br></div><div>1948-01-01<span class="Apple-tab-span" style="white-space:pre">        </span>51,7</div>
<div>1948-02-01<span class="Apple-tab-span" style="white-space:pre">        </span>50,2</div><div>1948-03-01<span class="Apple-tab-span" style="white-space:pre">        </span>43,3</div><div>1948-04-01<span class="Apple-tab-span" style="white-space:pre">        </span>45,4</div>
<div>1948-05-01<span class="Apple-tab-span" style="white-space:pre">        </span>49,5</div><div>1948-06-01<span class="Apple-tab-span" style="white-space:pre">        </span>53</div><div>1948-07-01<span class="Apple-tab-span" style="white-space:pre">        </span>48,4</div>
<div>1948-08-01<span class="Apple-tab-span" style="white-space:pre">        </span>45,1</div><div>1948-09-01<span class="Apple-tab-span" style="white-space:pre">        </span>42,1</div><div>1948-10-01<span class="Apple-tab-span" style="white-space:pre">        </span>47,2</div>
<div>1948-11-01<span class="Apple-tab-span" style="white-space:pre">        </span>42,4</div><div>1948-12-01<span class="Apple-tab-span" style="white-space:pre">        </span>35</div><div>1949-01-01<span class="Apple-tab-span" style="white-space:pre">        </span>32,9</div>
<div>1949-02-01<span class="Apple-tab-span" style="white-space:pre">        </span>31,3</div><div>1949-03-01<span class="Apple-tab-span" style="white-space:pre">        </span>34,5</div><div>1949-04-01<span class="Apple-tab-span" style="white-space:pre">        </span>35,5</div>
<div>1949-05-01<span class="Apple-tab-span" style="white-space:pre">        </span>32,6</div><div>1949-06-01<span class="Apple-tab-span" style="white-space:pre">        </span>31,6</div><div>etc...</div><div><br></div><div>I have attached it to this post.</div>
<div><br></div></div><div>I tried to read the file with getSymbols() but it gives me an error:</div><div>------------------------------------- start trace ----------------------------------------------</div><div>> library(quantmod)</div>
<div><div>> getSymbols('US_PMI_Monthly', src='csv', header = FALSE, sep = "\t", dec=",")</div><div>Error in dimnames(x) <- dn : </div><div> length of 'dimnames' [2] not equal to array extent</div>
<div>> </div><div>------------------------------------ end trace -------------------------------------------------</div><div><br></div><div>Strange because read.csv() can read this file into a data.frame:</div><div><br>
</div><div>-------------------------------------- start trace -----------------------------------------------</div><div><div>> data = read.csv("US_PMI_Monthly.csv", header = FALSE, sep = "\t", dec=",")</div>
<div>> class(data)</div><div>[1] "data.frame"</div><div>> </div><div>-------------------------------------- end trace -------------------------------------------------</div><div><br></div><div>I tried to be smart and convert the data.frame to an xts object, but this also gives me an error:</div>
<div><br></div><div>------------------------------------- start trace -------------------------------------------------</div><div><div>> as.xts(data)</div><div>Error in as.POSIXlt.character(x, tz, ...) : </div><div> character string is not in a standard unambiguous format</div>
<div>> </div><div>------------------------------------- end trace ---------------------------------------------------</div><div><br></div><div>I am using R 2.8.1 for windows with xts 0.6-6 and quantmod 0.3-10.</div><div>
<br></div><div>What am I doing wrong here?</div></div></div><div><br></div><div>Regards,</div><div><br></div><div>-Mark-</div></div>