<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi,<br>
something very strange today as I'm trying to simply read in the
attached CSV into R (it's small).<br>
I seem to be losing all decimals in the last column. I tried to set
`colClasses`, but made no difference.<br>
<br>
Not sure what's wrong with me today!<br>
Can any one replicate? I suppose it's in the input file, will keep
digging.<br>
Thx, --Mel.<br>
<br>
E.g. this is what I see when opening the CSV in emacs:<br>
<br>
<img src="cid:part1.02050704.05040207@mbacou.com" alt=""><br>
<br>
And then this is what shows up in R:<br>
<br>
```r<br>
pcn <- fread("PovCalServlet_15.08.03.csv")<br>
sapply(pcn, class)<br>
<br>
# country povLine mean hcr
gap sev <br>
# "character" "numeric" "numeric" "numeric" "numeric"
"numeric" <br>
# watts popM yearNum <br>
# "numeric" "numeric" "numeric" <br>
<br>
# => looks as expected, but then no decimal...<br>
<br>
pcn08$yearNum<br>
# [1] 2008 2012 2009 2009 2006 2008 2007 2008 2011 2004 2006 2011
2008 2010 2005<br>
# [16] 2003 2006 2008 2007 2012 2002 2005 2010 2007 2010 2010 2010
2008 2008 2012<br>
# [31] 2006 2009 2010 2011 2010 2011 2010 2011 2006 2011 2011 2009
2010 2012 2011<br>
# [46] 2008 2012 2009 2010 2008 2012 2009 2009 2006 2008 2007 2008
2011 2004 2006<br>
# [61] 2011 2008 2010 2005 2003 2006 2008 2007 2012 2002 2005 2010
2007 2010 2010<br>
# [76] 2010 2008 2008 2012 2006 2009 2010 2011 2010 2011 2010 2011
2006 2011 2011<br>
# [91] 2009 2010 2012 2011 2008 2012 2009 2010<br>
<br>
sessionInfo()<br>
# R version 3.2.1 (2015-06-18)<br>
# Platform: x86_64-w64-mingw32/x64 (64-bit)<br>
# Running under: Windows 7 x64 (build 7601) Service Pack 1<br>
# <br>
# locale:<br>
# [1] LC_COLLATE=English_United States.1252 <br>
# [2] LC_CTYPE=English_United States.1252 <br>
# [3] LC_MONETARY=English_United States.1252<br>
# [4] LC_NUMERIC=C <br>
# [5] LC_TIME=English_United States.1252 <br>
# <br>
# attached base packages:<br>
# [1] stats graphics grDevices utils datasets methods
base <br>
# <br>
# other attached packages:<br>
# [1] rgdal_1.0-4 sp_1.1-1 data.table_1.9.4
rj_2.0.3-2 <br>
# <br>
# loaded via a namespace (and not attached):<br>
# [1] magrittr_1.5 plyr_1.8.3 tools_3.2.1
rj.gd_2.0.0-1 <br>
# [5] reshape2_1.4.1 Rcpp_0.11.6 stringi_0.5-5
grid_3.2.1 <br>
# [9] stringr_1.0.0 chron_2.3-47 lattice_0.20-33<br>
<br>
```<br>
<pre class="moz-signature markdown-here-signature" cols="72">--
Melanie BACOU
International Food Policy Research Institute
Snr. Program Manager, Spatial Data and Analytics
Work +1(202)862-5699
E-mail <a class="moz-txt-link-abbreviated" href="mailto:m.bacou@cgiar.org">m.bacou@cgiar.org</a>
Visit <a class="moz-txt-link-abbreviated" href="http://www.harvestchoice.org">www.harvestchoice.org</a> </pre>
</body>
</html>