[英]Convert julian day to day/month/year
My post was apparently unclear, so I'm trying to fix it, don't hesitate to tell me if I'm still unclear!我的帖子显然不清楚,所以我正在尝试修复它,如果我仍然不清楚,请随时告诉我!
I got a dataframe of physical variables, with a data every minute.我得到一个物理变量的 dataframe,每分钟有一个数据。 I'd like to convert the 4 first columns into a single one: "%d/%m/%Y %H:%M" (GMT) in R.我想将前 4 列转换为一个:R 中的“%d/%m/%Y %H:%M”(格林威治标准时间)。
Year Julian_day Hour Minute Air_temp Water_temp Rel_hum Wind_int Wind_dir
2012 1 0 0 11.82 4.73 87.2 5.1 310
2012 1 0 1 11.92 4.743 87.2 5 310
2012 1 0 2 11.86 4.748 86.9 4.7 310
# This imports your data into a variable named "weather"
weather <- read.table(text = "Year Julian_day Hour Minute Air_temp Water_temp Rel_hum Wind_int Wind_dir
2012 1 0 0 11.82 4.73 87.2 5.1 310
2012 1 0 1 11.92 4.743 87.2 5 310
2012 1 0 2 11.86 4.748 86.9 4.7 310", header = TRUE)
# Combine the first four columns into a character vector
date_info <- with(weather, paste(Year, Julian_day, Hour, Minute))
# Parse that character vector
strptime(date_info, "%Y %j %H %M")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.