【问题标题】:Interchange the axes in R and count number of dates in a list in R交换 R 中的轴并计算 R 中列表中的日期数
【发布时间】:2011-10-08 18:00:18
【问题描述】:

我正在尝试使用 R 中的绘图函数。我希望 X 轴上表示的值位于 Y 轴上,反之亦然。

我的另一个问题是我有一份约会清单。我想知道列表中有多少特定日期的实例。

我该怎么做呢?

【问题讨论】:

    标签: r date count plot axes


    【解决方案1】:

    1)

     plot(y, x)  # I'm guessing there is something you are not telling us.
    

    在您使用带有单个“y”向量的默认索引的情况下,答案是:

     plot( x=y, y= 1:length(y) )  
        # This was reversed when it was posted as an edit-response to the comment.
    

    2)

     table(dates)[as.Date("YYYY-MM-DD")] # with the obvious substitutions
    

    【讨论】:

    • 我只有一个列表。所以我目前正在使用 plot(x)。
    • 谢谢!第二个答案正是我想要的!
    猜你喜欢
    • 1970-01-01
    • 2021-10-12
    • 1970-01-01
    • 2017-09-06
    • 2017-03-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多