Re: [R] code for year month day hr format

2024-06-15 Thread Jeff Newmiller via R-help
Please run your sequence of R statements one at a time so you can tell where the problem is. Only "run a script" after the code works one line at a time. There are too many places where things can go wrong otherwise. Is your file being read in properly? Is the filename correct? was the header

Re: [R] code for year month day hr format

2024-06-15 Thread Jibrin Alhassan
Thank you Rui. I ran the following script df1 <- read.table("solar_hour", header = TRUE) df1$date <- as.Date(paste(df1$year, df1$hour), format = "%Y %j", origin = "2012-08-01-0") df2 <- df1[c("date", "IMF", "SWS", "SSN", "Dst", "f10")] head(df1) #To display all the rows print(df2). It gave me

Re: [R] code for year month day hr format

2024-06-15 Thread Ebert,Timothy Aaron
library(lubridate) library(dplyr) df1 <- read.table(text = "YEAR DOY HR IMF SW SSNDst f10.7 2012 214 0 3.4 403. 132-9 154.6 2012 214 1 3.7 388. 132 -10 154.6 2012 214 2 3.7 383. 132 -10 154.6 2012 214 3 3.7 391. 132-9 154.6 2012 215 4 5.1 371. 143-4

Re: [R] code for year month day hr format

2024-06-15 Thread Rui Barradas
Às 20:00 de 15/06/2024, Jibrin Alhassan escreveu: I have solar-geophysical data e.g as blow: YEAR DOY HR IMF SW SSNDst f10.7 2012 214 0 3.4 403. 132-9 154.6 2012 214 1 3.7 388. 132 -10 154.6 2012 214 2 3.7 383. 132 -10 154.6 2012 214 3 3.7 391. 132-9 154.6

[R] code for year month day hr format

2024-06-15 Thread Jibrin Alhassan
I have solar-geophysical data e.g as blow: YEAR DOY HR IMF SW SSNDst f10.7 2012 214 0 3.4 403. 132-9 154.6 2012 214 1 3.7 388. 132 -10 154.6 2012 214 2 3.7 383. 132 -10 154.6 2012 214 3 3.7 391. 132-9 154.6 2012 214 4 4.2 399. 132-7 154.6 2012 214 5