I have a small data frame lie this:
> testdfcompound_1
E1 E2
2012-05-17 01:00:58 20.94700 2.148299
2012-05-17 01:01:57 15.36875 2.199166
2012-05-17 01:02:56 19.05800 2.697803
2012-05-17 01:03:55 17.90500 2.358735
And I want to get only the E1 value of the 1st element, so, 20.94700.
But I can't find a way to get it. If I try: testdfcompound_1$E1[1]
, I'm getting:
> testdfcompound_1$E1[1]
E1
2012-05-17 01:00:58 20.947
How do I get only the 20.947 ?
Double the square brackets.
d1 <- data.frame(a=1:5, b=rnorm(5))
d1$b[[3]]
That should do it. But there are many ways to do this...
as.double( testdfcompound_1$E1[1])
Then you get the value also. Was "2012-05-17 01:00:58" and "E1" not the row and column name in your case?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With