可视化R中的人员配置 [英] Visualizing a staffing schedules in R

查看:185
本文介绍了可视化R中的人员配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一组数据,主要由3个字段组成:



1)位置2)Start_of_shift(datetime对象)3)End_of_Shift(datetime对象)



从datetime对象我可以提取日期,星期几&时间。这些日程安排是24/7,不符合任何标准3班等轮换,它们对于一个网站是相当具体的。 (我正在使用lubridate包)



我希望可视化一天中的时间与星期几来显示员工人数,以便我可以看到浓度工作人员以及我在特定日期和时间的光线。



我不确定如何处理这个问题,因为我比较新的R,我已经找到了不同的日期时间包基础实用程序混淆并且经常相互冲突。虽然我发现了很多时间序列绘图的例子,但是如果您在单独的字段中有开始和结束时间,并且想要显示重叠区域,那么我就找不到关于如何绘制的内容。


$ b $我正在考虑使用ggplot2与geom_tile来绘制出来,更平滑,但想知道是否有任何类似的例子,或者任何人有什么想法如何转换我的数据最好地实现我的最终目标。我想保持时间连续,但作为最后的手段,如果有必要,我会把它离散成15分钟的大块,但不知道是否有其他选择?



任何想法?

解决方案

也许时间线包是您需要的。我发现它对于规划项目很有好处。它在CRAN上,但您可以在Github主页此处看到一个简单的例子。


First time poster here, so please forgive any faux pas on my part.

I have a set of data which consists of essentially 3 fields:

1)Position 2)Start_of_shift (datetime object) 3)End_of_Shift (datetime object)

From the datetime object I can extract date, day of week, & time. The schedules are 24/7 and do not conform to any standard 3 shift etc. rotation, they are fairly specific to a site. (I am using the lubridate package)

I would like to visualize Time of day vs. Day of Week to show numbers of staff, so that I can see heavy concentrations of staff and where I am light at specific days and times.

I am unsure on how to approach this problem as I am relatively new to R and I have found the various date time packages & base utilities confusing and often conflicting with each other. While I find plenty of examples of time series plotting, I have found next to nothing on how to plot if you have a start and end time in separate fields and want to show areas of overlap

I was thinking of using ggplot2 with geom_tile to plot this out, with a smoother, but wanted to know if there were any good examples out there that do something similar or if anyone has any idea on how I should transform my data to best achieve my end objective. I wanted to keep the time continuous but as a last resort I will discretize it into 15 minute chunks if necessary, but didn't know if there were other options?

Any thoughts?

解决方案

Maybe the timeline package is what you need. I've found it very good for planning projects. It's on CRAN, but you can see a quick example at it's Github home here.

这篇关于可视化R中的人员配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆