Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
249 views
in Technique[技术] by (71.8m points)

How do you plot the temporal distribution of a variable by month and day on the y-axis, and by year on the x-axis using R software?

dput(my.df)

df <- structure(list(survey_date = structure(c(18017, 18018, 18019, 
18020, 18021, 18022, 18023, 18024, 18025, 18026, 18027, 18028, 
18029, 18030, 18031, 18032, 18033, 18034, 18035, 18036, 18037, 
18038, 18039, 18040, 18041, 18042, 18043, 18044, 18045, 18046, 
18047, 18048, 18049, 18050, 18051, 18052, 18052, 18053, 18054, 
18055, 18056, 18057, 18058, 18059, 18060, 18061, 18062, 18063, 
18064, 18065, 18066, 18067, 18068, 18069, 18070, 18071, 18072, 
18073, 18073, 18074, 18075, 18076, 18077, 18078, 18079, 18080, 
18081, 18082, 18083, 18084, 18085, 18086, 18087, 18088, 18089, 
18090, 18091, 18092, 18093, 18094, 18095, 18096, 18097, 18098, 
18099, 18100, 18101, 18102, 18103, 18104, 18105, 18106, 18107, 
18108, 18109, 18110, 18111, 18112, 18113, 18114, 18115, 18116, 
18117, 18118, 18119, 18120, 18121, 18122, 18123, 18124, 18125, 
18126, 18127, 18128, 18129, 18130, 18131, 18132, 18133, 18134, 
18135, 18136, 18137, 18138, 18139, 18140, 18141, 18142, 18143, 
18144, 18145, 18146, 18147, 18148, 18149, 18150, 18151, 18152, 
18153, 18154, 18155, 18156, 18157, 18158, 18159, 18160, 18161, 
18162, 18163, 18164, 18165, 18166, 18167, 18168, 18169, 18170, 
18171, 18172, 18173, 18174, 18175, 18176, 18177, 18178, 18179, 
18180, 18181, 18182, 18183, 18184, 18185, 18186, 18187, 18188, 
18189, 18190, 18191, 18192, 18193, 18194, 18195, 18196, 18197, 
18198, 18199, 18200, 18383, 18384, 18385, 18386, 18387, 18388, 
18389, 18390, 18391, 18392, 18393, 18394, 18395, 18396, 18397, 
18398, 18399, 18400, 18401, 18402, 18403, 18404, 18405, 18406, 
18407, 18408, 18409, 18410, 18411, 18412, 18413, 18414, 18415, 
18416, 18417, 18418, 18419, 18420, 18421, 18422, 18423, 18424, 
18425, 18426, 18427, 18428, 18429, 18430, 18430, 18431, 18432, 
18433, 18434, 18435, 18436, 18437, 18438, 18439, 18440, 18441, 
18442, 18443, 18444, 18445, 18446, 18447, 18448, 18449, 18450, 
18451, 18452, 18453, 18454, 18455, 18456, 18457, 18458, 18459, 
18460, 18461, 18462, 18463, 18464, 18465, 18466, 18467, 18468, 
18469, 18470, 18471, 18472, 18473, 18474, 18475, 18476, 18477, 
18478, 18479, 18480, 18481, 18482, 18483, 18484, 18485, 18486, 
18487, 18488, 18489, 18490, 18491, 18492, 18493, 18494, 18495, 
18496, 18497, 18498, 18499, 18500, 18501, 18502, 18503, 18504, 
18505, 18506, 18507, 18508, 18509, 18510, 18511, 18512, 18513, 
18514, 18515, 18516, 18517, 18518, 18519, 18520, 18521, 18522, 
18523, 18524, 18525, 18526, 18527, 18528, 18529, 18530, 18531, 
18532, 18533, 18534, 18535, 18536, 18537, 18538, 18539, 18540, 
18541, 18542, 18543, 18544, 18545, 18546, 18547, 18548, 18549, 
18550, 18551, 18552, 18553, 18554, 18555, 18556, 18557, 18558, 
18559, 18560, 18561, 18562, 18563, 18564, 18565, 18566), class = "Date"), 
    year = c(2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 
    2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 
    2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 
    2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 
    2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 
    2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 
    2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 
    2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 
    2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 
    2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 
    2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 
    2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 
    2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 
    2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 
    2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 
    2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 
    2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 
    2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 
    2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2020, 2020, 
    2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 
    2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 
    2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 
    2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 
    2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 
    2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 
    2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 
    2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 
    2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 
    2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 
    2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 
    2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 
    2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 
    2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 
    2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 
    2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 
    2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 
    2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 
    2020, 2020, 2020), surveys = c(NA, NA, NA, NA, NA, NA, NA, 
    NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
    NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 2L, 2L, 
    NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
    NA, NA, NA, NA, NA, 2L, 2L, NA, NA, NA, NA, NA, NA, NA, NA, 
    NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
    NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
    NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
    NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
    NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
    NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
    NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
    NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
    NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
    NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
    NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
    NA, 2L, 2L, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
    NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
    NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
    NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
    NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
    NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
    NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
    NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
    NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
    NA, NA, NA, NA)), row.names = c(NA, -371L), class = c("tbl_df", 
"tbl", "data.frame"))

I have a tibble of survey data (subsetted to only two years to reduce it's size), containing the following variables: survey_date (dates when surveys were taken), year (of survey), surveys (number of surveys completed on each survey_date). The survey was done during the same time period each year (May through October), but survey dates within that period could vary. Year should be on the x-axis, and I want to plot on the y-axis, for each year of the survey, the temporal distribution of survey dates as points within the time period (time period plotted on y-axis). I am trying to compare the temporal distribution of surveys within each year over time to show whether or not the survey dates have trended over time within the time period.

question from:https://stackoverflow.com/questions/65944646/how-do-you-plot-the-temporal-distribution-of-a-variable-by-month-and-day-on-the

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...