0

I have some data in R,

             Open    High     Low   Close
2017-09-01 1.29360 1.29951 1.29052 1.29495
2017-09-03 1.29600 1.29660 1.29444 1.29535
2017-09-04 1.29536 1.29643 1.29124 1.29300
2017-09-05 1.29306 1.30440 1.29088 1.30331
2017-09-06 1.30331 1.30820 1.30181 1.30471
2017-09-07 1.30472 1.31381 1.30325 1.31319
2017-09-08 1.31319 1.32239 1.31233 1.31945
2017-09-10 1.31816 1.31978 1.31736 1.31769
2017-09-11 1.31769 1.32223 1.31593 1.31764
2017-09-12 1.31766 1.33145 1.31703 1.33097
2017-09-13 1.33096 1.33286 1.31836 1.32040
2017-09-14 1.32039 1.34055 1.31501 1.33955
2017-09-15 1.33955 1.36159 1.33922 1.35871
2017-09-17 1.35579 1.36029 1.35579 1.35921
2017-09-18 1.35921 1.36181 1.34646 1.35176
2017-09-19 1.35176 1.35515 1.34683 1.35178
2017-09-20 1.35178 1.36573 1.34517 1.34914
2017-09-21 1.34914 1.35861 1.34706 1.35761
2017-09-22 1.35760 1.35955 1.34496 1.34935
2017-09-24 1.34872 1.35339 1.34832 1.35261
2017-09-25 1.35262 1.35706 1.34308 1.34816
2017-09-26 1.34816 1.35139 1.34094 1.34385
2017-09-27 1.34386 1.34389 1.33634 1.33753
2017-09-28 1.33754 1.34551 1.33427 1.34159
2017-09-29 1.34160 1.34258 1.33497 1.33963

If I choose a date of 2017-09-01 I want it to return the value of the Open column, so 1.29360.

This is the format.

structure(c(1.2936, 1.296, 1.29536, 1.29306, 1.30331, 1.30472, 
1.29951, 1.2966, 1.29643, 1.3044, 1.3082, 1.31381, 1.29052, 1.29444, 
1.29124, 1.29088, 1.30181, 1.30325, 1.29495, 1.29535, 1.293, 
1.30331, 1.30471, 1.31319), class = c("xts", "zoo"), .indexCLASS = c("POSIXct", 
"POSIXt"), tclass = c("POSIXct", "POSIXt"), .indexTZ = "", tzone = "", index = structure(c(1504224000, 
1504396800, 1504483200, 1504569600, 1504656000, 1504742400), tzone = "", tclass = c("POSIXct", 
"POSIXt")), .Dim = c(6L, 4L), .Dimnames = list(NULL, c("Open", 
"High", "Low", "Close")))

TIA

Al Sweigart
  • 11,566
  • 10
  • 64
  • 92
User314159
  • 39
  • 4
  • 1
    This is better than your last question because it focuses on a single issue, but **please show what you tried**. Your questions will get a fast and helpful response if (1) you show what you tried, and (2) you share data [reproducibly. This link has a good tutorial on how to share data reproducibly.](https://stackoverflow.com/q/5963269/903061). – Gregor Thomas Oct 25 '17 at 19:57
  • In this case, `dput(head(your_data))` or `dput(droplevels(head(your_data)))` will make a subset of your data copy/pasteable, and it will show the structure of your data (data frame? Matrix? something else?) and it will provide the column classes (is your date column a `Date` class, or maybe `POSIXct`, or `character`, something else?), all of which is important to know how to help you. – Gregor Thomas Oct 25 '17 at 19:58
  • All right, that's #2 taken care of (it would be best if you edit it into your question), how about #1? – Gregor Thomas Oct 25 '17 at 20:13
  • Like I've said, I don't know ANY functions in R, so haven't found anything to be useful yet. – User314159 Oct 25 '17 at 20:30
  • 2
    And like I've said, *asking questions here does not make a good replacement for reading tutorials that cover the basics of R.* [The R tag wiki has a great list of resources for starting with R](https://stackoverflow.com/tags/r/info). I've heard a lot of good things about Swirl recently. – Gregor Thomas Oct 25 '17 at 20:57
  • Is this `data['2017-09-01']$Open` what you want? – Patricio Moracho Oct 25 '17 at 21:07

0 Answers0