0

I am new to R and I want to know how to write a code for my following question. I have excel file in the following format. 1. I want to create a time series from first 4 column, each and every column represent year, month, date, time(hours) 2. Plot the time series against 2 stations that I have (X991 and X5779) Note: first raw indicate what type of time seris (Temperature), second raw is height of the station, third row is X coordinate, fourth row is Y coordinate and fifth row is station name (X991, X5779), therfore i want to skip these rows and plot my time series

can anyone please help me with this

Temperature                 
YY  MM  DD  HH  365 877
YY  MM  DD  HH  50.9117 50.7314
YY  MM  DD  HH  13.7087 13.7516
YY  MM  DD  HH  X991    X5779
2000    1   1   0   -9999   -4.3
2000    1   1   1   -9999   -4.3
2000    1   1   2   -9999   -4.1
2000    1   1   3   -9999   -4.1
2000    1   1   4   -9999   -4.4
2000    1   1   5   -9999   -4.2
2000    1   1   6   -9999   -4
2000    1   1   7   -9999   -3.9
2000    1   1   8   -9999   -3.8
2000    1   1   9   -9999   -3.7
2000    1   1   10  -9999   -3.5
2000    1   1   11  -9999   -3.1
2000    1   1   12  -9999   -2.7
2000    1   1   13  -9999   -2.5
2000    1   1   14  -9999   -2.4
Sotos
  • 51,121
  • 6
  • 32
  • 66

1 Answers1

1

There is a lot here....

First off, welcome to Stack Overflow. This community can be very helpful...but you have to learn how to get the most out of it. Check out this page https://stackoverflow.com/help/how-to-ask.

The problem with your question is that you are asking several different questions here...and are unlikely to have somebody answer them all for you.

Here are the different questions you are asking, and some resources that will get you started. Once you attempt these pieces, and get stuck, you can ask again about a SPECIFIC piece...including what you have tried already.

  1. Getting data into R. I would first delete the unnecessary rows in Excel...will be much easier. Then import your data into R

Importing .xlsx file into R

  1. Next, you need to concatenate the fields into a datetime value...these pages will help you.

Merge three different columns into a date in R

R tick data : merging date and time into a single object

  1. In R, time series analysis requires a ts object to be created. This page will help you do that.

How to Create a R TimeSeries for Hourly data

  1. Then, you are ready to start you r time series analysis....here is a good guide to time series in R

http://www.statmethods.net/advstats/timeseries.html

Good luck!

pyll
  • 1,688
  • 1
  • 26
  • 44