[R] Working with Data Frames

Bert Gunter bgunter.4567 at gmail.com
Wed Nov 4 01:57:30 CET 2015


Have you gone through any R tutorials? There are innumerable good ones
on the web -- and one that ships with R (An Intro to R). Don't you
think you should make an effort to learn some basics on your own
before posting here?

... or do I misinterpret your question? (And if so, my apologies --
feel free to chastise me appropriately).

Cheers,
Bert


Bert Gunter

"Data is not information. Information is not knowledge. And knowledge
is certainly not wisdom."
   -- Clifford Stoll


On Tue, Nov 3, 2015 at 4:26 PM, Robert Sherry <rsherry8 at comcast.net> wrote:
> I have created what I believe to be a data frame. It is called env1$SPY.
> The r statement head( env1$SPY ) produces the following output:
>
>            SPY.Open SPY.High SPY.Low SPY.Close SPY.Volume SPY.Adjusted
> 1995-01-03  45.7031  45.8437 45.6875   45.7812     324300 31.55312
> 1995-01-04  45.9843  46.0000 45.7500   46.0000     351800 31.70392
> 1995-01-05  46.0312  46.1093 45.9531   46.0000      89800 31.70392
> 1995-01-06  46.0937  46.2500 45.9062   46.0468     448400 31.73617
> 1995-01-09  46.0312  46.0937 46.0000   46.0937      36800 31.76850
> 1995-01-10  46.2031  46.3906 46.1406   46.1406     229800 31.80082
>
> The above data from was created by the following commands:
>     library( quantmod )
>     env1 <- new.env()
>     getSymbols("SPY", src = 'yahoo', from = '1995-01-01', env = env1,
> auto.assign = T)
>
> Now, what I want to do is to loo through the data look for when the month
> changes. What is the proper way of writing a for loop in
> R and access the date field?
>
> Bob
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list