series' value (R ggplot)

I've got a time-series data frame with pressure readings taken at regular intervals. time pressure diff 1 2014-09-09 09:12:29 1.6191598 0.00000000 2 2014-09-09 09:12:28 3.0137784 -0.07668387 3 2014-09-09 09:12:27 1.1958183 0.58693260 4 2014-09-09 09:12:26 2.2803681 1.07774954 5 2014-09-09 09:12:25 -0.7614310 -0.17864232 6 2014-09-09 09:12:24 0.9914106 -0.70

系列'值(R ggplot)

我有一个时间序列数据框,并定期读取压力读数。 time pressure diff 1 2014-09-09 09:12:29 1.6191598 0.00000000 2 2014-09-09 09:12:28 3.0137784 -0.07668387 3 2014-09-09 09:12:27 1.1958183 0.58693260 4 2014-09-09 09:12:26 2.2803681 1.07774954 5 2014-09-09 09:12:25 -0.7614310 -0.17864232 6 2014-09-09 09:12:24 0.9914106 -0.70121973 我可以使用ggplot2轻松地绘制压力线图

ggplot2 time series plot with colour coded wind direction arrows

Good afternoon, I am trying to produce a time-series plot with arrows showing wind direction and coloured to show wind speed strength. Ultimately I am trying to get a plot something like this (just an example picture I found online): I have managed to find a similar post (see below) and I tried to follow but I am stuck with the displaying of Wind Direction arrows correctly. Previous simila

用颜色编码的风向箭头绘制ggplot2时间序列图

下午好, 我正在尝试制作一个带有箭头的时间序列图,显示风向并着色显示风速强度。 最终,我试图得到一个这样的情节(只是我在网上找到的一个示例图片): 我设法找到了一个类似的帖子(见下文),我试图跟随,但我坚持正确显示风向箭头。 上一个类似的帖子:ggplot2带箭头/矢量的风时间系列 我到目前为止编写的代码如下: require(ggplot2) require(scales) require(gridExtra) require(lubridate) dat <- data.fr

R: Scatter plot of time series data for multiple points, ggplot?, reshape?

I have data in the following format. Column V1 is the genomic location of interest, and column V4 and V5 are the minor allele frequencies at two different points in time. I would like to make a simple xy scatter plot with a line connecting the allele frequency for each specific location from timepoint 1 to timepoint 2(plotted on y-axis). (Note, I actually have hundreds to thousands of data poi

R:多点时间序列数据的散点图,ggplot?,重塑?

我有以下格式的数据。 列V1是感兴趣的基因组位置,列V4和V5是在两个不同时间点的次要等位基因频率。 我想用时间点1到时间点2(绘制在y轴上)的每个特定位置的连接等位基因频率的线作一个简单的xy散点图。 (请注意,我实际上有数百到数千个数据点)。 V1 V2 V3 V4 V5 1 153 1/113 1/115 0.008849558 0.008695652 2 390 0/176 150/152 0.000000000 0.986842105 3 445 1/149 1/152 0.00671140

bar axis limits

Yesterday I asked a question about plotting hourly data with ggplot2 (R ggplot2 ploting hourly data) and found a solution thanks to the answers received. Then I succedeed ploting temperature data with geom_line(). I tried to apply the same to geom_bar to illustrate precipitation data with bars. But I can't manage to set the y axis limits. I've tried different things but can't fin

棒轴限制

昨天我问了一个关于使用ggplot2绘制每小时数据的问题(R ggplot2绘制每小时数据),并且发现了一个解决方案,得益于收到的答案。 然后我用geom_line()成功绘制了温度数据。 我尝试将其应用于geom_bar以用条形图来说明降水数据。 但我无法设置y轴限制。 我尝试了不同的东西,但找不到确切的点。 我的数据如下所示: FECHA H_SOLAR;DIR_M;VEL_M;TEMP_M;HR;PRECIP 01/06/14 00:50:00;314.3;1.9;14.1;68.0;-99.9 01/06/14 0

R & ggplot2: How to get arrows under the axis label?

I'm about to plot odds ratios with R/ggplot2 and I want to add two arrows underneath or next to the X-axis label. One pointing to the left, one pointing to the right, showing de-/increasing influence. I've tried lots of things, like geom_path, geom_line, without great success. This is my code: forest <- function(d, xlab="Odds Ratio", ylab="Influencing variables"){ require(ggplot2)

R&ggplot2:如何获取轴标签下的箭头?

我打算用R / ggplot2绘制比值比,并且我想在X轴标签的下面或旁边添加两个箭头。 一个指向左边,一个指向右边,表现出去/增加的影响力。 我尝试了很多东西,比如geom_path,geom_line,但没有取得很大的成功。 这是我的代码: forest <- function(d, xlab="Odds Ratio", ylab="Influencing variables"){ require(ggplot2) p <- ggplot(d, aes(x=ordered(x, levels=rev(x)), y=y, ymin=ylo, ymax=yhi)) + geom_pointrange

Multiply rows of matrix by vector?

I'm optimizing a function and I want to get rid of slow for loops. I'm looking for a faster way to multiply each row of a matrix by a vector. Any ideas? EDIT: I'm not looking for a 'classical' multiplication. Eg. I have matrix that has 23 columns and 25 rows and a vector that has length of 23. In a result I want to have matrix 25x23 that has each row multiplied by ve

用矢量乘以矩阵行?

我正在优化一个函数,我想摆脱慢循环。 我正在寻找一种更快的方法来将矩阵的每一行乘以一个向量。 有任何想法吗? 编辑: 我不是在寻找一种“古典”的乘法。 例如。 我有矩阵,有23列和25行,矢量的长度为23.结果我想要矩阵25x23,每行乘以矢量。 我认为你正在寻找sweep() 。 > (mat <- matrix(rep(1:3,each=5),nrow=3,ncol=5,byrow=TRUE)) [,1] [,2] [,3] [,4] [,5] [1,] 1 1 1 1 1 [2,]

Load a shared library linked to Rust library in R

Following up on this question here, I am having issues using dyn.load to load a shared library that is linked to a Rust dylib. I suspect it has something to do with where R is looking for the Rust dylib, but I have not found a way to specify another location than whatever the default is. From R, I execute the following: > dyn.load('src/test.so') And receive this error message: Error in d

加载链接到R中的Rust库的共享库

在这里继续讨论这个问题,我遇到了使用dyn.load加载链接到Rust dylib的共享库的问题。 我怀疑它与R在寻找Rust dylib的地方有关,但我还没有找到一种方法来指定另一个位置,而不管默认设置是什么。 从R,我执行以下操作: > dyn.load('src/test.so') 并收到此错误消息: Error in dyn.load("src/test.so") : unable to load shared object '/Users/Zelazny7/r-dev/rustr/src/test.so': dlopen(/Users/Zelazny7/r-dev

how to propery specify a gradient function for use in optim() or other optimizer

I have an optimization problem that the Nelder-Mead method will solve, but that I would also like to solve using BFGS or Newton-Raphson, or something that takes a gradient function, for more speed, and hopefully more precise estimates. I wrote such a gradient function following (I thought) the example in the optim / optimx documentation, but when I use it with BFGS my starting values either don&

如何propery指定用于optim()或其他优化器的渐变函数

我有一个Nelder-Mead方法可以解决的优化问题,但是我也想使用BFGS或Newton-Raphson或其他需要梯度函数的方法来求解,以获得更快的速度,并希望得到更精确的估计。 我在optim / optimx文档中编写了这样一个渐变函数(我认为),但是当我将它用于BFGS我的起始值不会移动( optim() ),否则函数彻底不运行( optimx() ,它返回Error: Gradient function might be wrong - check it! )。 我很抱歉有一些代码涉及再现这一点,但这

8 characters get lost when converting from list to data.frame in R

I am using R 3.2.0 with RStudio 0.98.1103 on Windows 7 64-bit. The Windows "regional and language settings" of my computer is English (United States). For some reason the following code replaces my Czech characters "č" and "ř" by "c" and "r" in the text "Koryčany nad přehradou", when I read a XML file in utf-8 encoding from the web, p

从R列表转换为data.frame时,8个字符会丢失

我在Windows 7 64位上使用R 3.2.0和RStudio 0.98.1103。 我的电脑的Windows“区域和语言设置”是英语(美国)。 由于某些原因,当我从web上以utf-8编码读取XML文件时,以下代码将文本“Koryčanynadpřehradou”中的“c”和“r”替换为捷克文字“č”和“r”,解析将XML文件转换为列表,并将列表转换为data.frame。 library(XML) url <- "http://hydrodata.info/chmi-h/cuahsi_1_1.asmx/GetSiteInfoObject?site=CHMI-H:1263&authToken

How to set a breakpoint in function body in R

I have an R script which calls a function written by me. However, when I execute the script, the program doesn't stop at the debug point in the function body. The only time debug points work is when they are set in the main script file. I am using R-studio IDE, however any general solution would also be appreciated. If you work on multiple files, you have to source R files with debugSou

如何在R中的函数体中设置断点

我有一个R脚本,它调用我写的函数。 但是,当我执行脚本时,程序不会停止在函数体中的调试点。 调试点工作的唯一时间是在主脚本文件中设置它们的时间。 我正在使用R-studio IDE,但是任何常规解决方案也将被赞赏。 如果您使用多个文件,则必须使用R源文件 debugSource("C:/Users/...") 代替 source("C:/Users/...") 从你的主要脚本