0

I have a list of dates and temperatures,

    2016-03-28 2016-03-29 2016-03-22 2016-04-14 2016-04-25 2016-03-30 2016-04-10 
    45.6692    48.7166    49.9586    54.3002    55.4288    56.1650    57.3332

that I would like to convert to a dataframe with two columns:

          date     temp
    2016-03-28  45.6692
    2016-03-29  48.7166
    2016-03-22  49.9586

and so on. Let me know if I can provide any further information. Thanks.

phaser
  • 565
  • 1
  • 11
  • 28
  • What is your input, a file, an R object: dataframe, vector? Please provide [reproducible example](http://stackoverflow.com/questions/5963269). This post might be [relevant](http://stackoverflow.com/questions/1181060). – zx8754 Jul 28 '16 at 20:38

1 Answers1

0

If you have a vector like v

v <- rnorm(10,50,3) 
names(v) <- as.Date(1:10,origin="2016-10-21")

Then I would just extract names in one column and values in another:

data.frame(temp=unname(v),date=names(v))
Dambo
  • 3,318
  • 5
  • 30
  • 79