我需要使用summarySE函数的输出来使用ggplot2创建一个图,但是不能让R按顺序识别我的“Date”列:
>summarySE(data,measurevar="Oxygen",groupvars=c("Source","Date"))
#Output:
Source Date N Oxygen sd se ci
1 Fog 1.)Jan-31-2014 3 -4.355901 0.196322432 0.113346809 0.48769196
2 Fog 10.)Nov-22-2014 4 -3.441414 0.060031671 0.030015835 0.09552378
3 Fog 11.)Dec-19-2014 4 -3.385476 0.038275092 0.019137546 0.06090421
4 Fog 12.)Jan-14-2015 4 -4.721962 0.026494983 0.013247491 0.04215943
5 Fog 2.)Feb-7-2014 3 -3.740524 0.035711432 0.020618005 0.08871211
6 Fog 3.)Mar-20-2014 4 -3.628936 0.067399425 0.033699712 0.10724753
7 Fog 4.)Apr-17-2014 4 -3.627012 0.054002864 0.027001432 0.08593061
8 Fog 5.)May-13-2014 4 -3.500093 0.037486626 0.018743313 0.05964959
9 Fog 6.)Jun-3-2014 4 -3.288078 0.008646264 0.004323132 0.01375813
10 Fog 7.)Jul-11-2014 4 -2.984399 0.013962777 0.006981388 0.02221789
11 Fog 8.)Jul-25-2014 4 -3.706374 0.017407627 0.008703813 0.02769942
12 Fog 9.)Aug-15-2014 4 -4.692308 0.054897334 0.027448667 0.08735391
13 Rain 1.)Jan-31-2014 3 -4.256694 0.035114018 0.020273088 0.08722806
14 Rain 10.)Nov-22-2014 4 -4.505152 0.026227980 0.013113990 0.04173457
15 Rain 11.)Dec-19-2014 4 -3.232620 0.033731519 0.016865759 0.05367437
16 Rain 12.)Jan-14-2015 2 -4.934984 0.044586548 0.031527451 0.40059424
17 Rain 2.)Feb-7-2014 3 -3.797345 0.084238433 0.048635082 0.20925987
18 Rain 3.)Mar-20-2014 4 -4.697399 0.019020788 0.009510394 0.03026632
19 Rain 4.)Apr-17-2014 4 -3.898522 0.024764476 0.012382238 0.03940581
20 Rain 5.)May-13-2014 4 -3.277104 0.053778126 0.026889063 0.08557300
21 Rain 6.)Jun-3-2014 4 -3.332392 0.067044062 0.033522031 0.10668206
22 Rain 7.)Jul-11-2014 4 -2.574357 0.019725476 0.009862738 0.03138763
23 Rain 9.)Aug-15-2014 4 -4.356316 0.012041910 0.006020955 0.01916137
建议?
答案 0 :(得分:0)
根据建议,将日期类别设为日期。
require(dplyr)
require(tidyr)
require(lubridate)
#make dates REAL dates
data <- data %>%
separate(Date,c("mySpeialNumber","temp"),sep="\\)") %>%
mutate(Date=mdy(temp)) %>%
select(-temp)
#run summarySE
summarySE(data,measurevar="Oxygen",groupvars=c("Source","mySpeialNumber","Date"))