Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/73.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R GGPLOT X轴值指日期(M/Y)_R_Ggplot2_Plot - Fatal编程技术网

R GGPLOT X轴值指日期(M/Y)

R GGPLOT X轴值指日期(M/Y),r,ggplot2,plot,R,Ggplot2,Plot,每次我需要解决这个问题的时候,我都会遇到同样的问题,有时我可以解决它,但这次我没有得到解决 数据集(示例): 身份证件 日期 PZ 第2.1款 susbt.2 id1 01-12-99 1. 10 62 id1 01-02-00 2. 46 25 id2 01-12-99 3. 81 5. id2 01-02-00 4. 32 1. id3 01-12-99 3. 41 8. id3 01-02-00 3. 2. 15 我认为您的解决方案#1可行,但有一个bug。您需要将指定为.factor,即

每次我需要解决这个问题的时候,我都会遇到同样的问题,有时我可以解决它,但这次我没有得到解决

数据集(示例): 身份证件 日期 PZ 第2.1款 susbt.2 id1 01-12-99 1. 10 62 id1 01-02-00 2. 46 25 id2 01-12-99 3. 81 5. id2 01-02-00 4. 32 1. id3 01-12-99 3. 41 8. id3 01-02-00 3. 2. 15 我认为您的解决方案#1可行,但有一个bug。您需要将
指定为.factor
,即

data$dateFactor <- as.factor(data$date)
levels(data$dateFactor)  <- c("DEZ-99","FEB-00")

data$dateFactor各位好的,谢谢阅读。
发帖后,我看到了我的错误,改正了问题,解决了因子问题。

然后通过对级别进行排序解决了另一个问题。通过执行data$date,尝试以下方法将日期转换为日期:
df$date@WillOldham,这不起作用,因为当您以这种方式绘制数据时,带日期格式的x轴只显示相等的距离日期,而不是每个值为y的x。或者可能添加x_刻度函数,带休息时间=月,可能有效,可以尝试!但现在我发布了一条新评论,说我想这已经解决了