交换 R 中的轴并计算 R 列表中的日期数

发布于 2024-11-25 13:57:20 字数 111 浏览 3 评论 0原文

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

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

我该怎么做呢?

I am trying to use the plot function in R. I would like to have the values which are represented on the X-axis to be on the Y-axis and vice-versa.

Another question I have is I have a list of dates with me. I want to know how many instances of a particular date are there in the list.

How should I go about doing this ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

喜爱皱眉﹌ 2024-12-02 13:57:20

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

1)

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

In the situation where you are using the default indexing with a single "y" vector the answer would be:

 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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文