Quantcast
Channel: R.NET
Viewing all articles
Browse latest Browse all 1634

New Post: DatemTime reading immposible.

$
0
0
It is possible. A similar question was already asked in (this post)[https://rdotnet.codeplex.com/discussions/531632]

For your particular case:
# note: sample code using IronPython
e.Evaluate("x <- read.csv('c:/tmp/testdf.csv', header=T)")
e.Evaluate('str(x)')
# Simplest solution:
datesChar = e.Evaluate('as.character(x[,1])').ToArray()

# Or, if you insist in doing things in c#
df = e.Evaluate("x")
df = df.AsDataFrame()
dates = df[0]
indices = dates.AsInteger().ToArray()
levels = dates.AsFactor().GetFactors()
# Then reconstruct the array of strings by indexing and factors
Where the file contains:
Date,a,b,c,d
1984-01-24,1,6,4,2.3
1984-01-25,1,6,4,2.3
1984-01-26,1,6,4,2.3

Viewing all articles
Browse latest Browse all 1634

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>