R segments can't handle transparency?

In R (3.0.2 in Windows 7) segments() function can't handle transparency? dev.new(width=10,height=10) par(mar=c(0,0,0,0)) x = 1:10 y = 10:1 plot(x,y) segments(0,0,10,10,col=rgb(0,0,0,0.5)) This should draw a gray line over the plot, but nothing is drawn. Why? According to grDevices help, ( ?dev.capabilities ) Most recent devices support semi-transparent colours provided the graphics for

R细分市场无法处理透明度?

在R(Windows 7中的3.0.2)段()函数不能处理透明度? dev.new(width=10,height=10) par(mar=c(0,0,0,0)) x = 1:10 y = 10:1 plot(x,y) segments(0,0,10,10,col=rgb(0,0,0,0.5)) 这应该在情节上绘制一条灰线,但没有画任何东西。 为什么? 根据grDevices的帮助,( ?dev.capabilities ) 提供图形格式的最新设备支持半透明颜色(PostScript不支持)。 另一方面,相对较少的图形格式支持(完全或半透明)背景:通常后者

dyn.load crashes without any clue

I tried to use dyn.load command for loading external dll libraries, but it close my R session after running the command every time. I'm using windows 10 and here is my R version: version _ platform x86_64-w64-mingw32 arch x86_64 os mingw32 system x86_64, mingw32 status major 3 minor 1.3 year 2015 month 03 day 09 svn rev 67962 language R version.string R version 3.

dyn.load崩溃没有任何线索

我试图使用dyn.load命令来加载外部DLL库,但每次运行该命令后都会关闭我的R会话。 我使用的是Windows 10,这里是我的R版本: 版本_ 平台x86_64-w64-mingw32 arch x86_64 os mingw32 系统x86_64,mingw32 状态 重大3 次要1.3 2015年 03月 09日 svn rev 67962 语言R version.string R版本3.1.3(2015-03-09)昵称Smooth Sidewalk 测试这个,这里是一个简单的代码来锁定屏幕使用Windows本机DLL: dy

I am unable to download the reshape2 package in R

I am getting this response when trying to install the R package: >installed.packages("reshape2") Package LibPath Version Priority Depends Imports LinkingTo Suggests Enhances License License_is_FOSS License_restricts_use OS_type Archs MD5sum NeedsCompilation Built R version 3.2.2 (2015-08-14) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 8 x64 (build 9200)

我无法下载R中的reshape2软件包

试图安装R软件包时,我收到了这个响应: >installed.packages("reshape2") Package LibPath Version Priority Depends Imports LinkingTo Suggests Enhances License License_is_FOSS License_restricts_use OS_type Archs MD5sum NeedsCompilation Built R版本3.2.2(2015-08-14)平台:x86_64-w64-mingw32 / x64(64位)运行于:Windows 8 x64(内部版本9200) 您调用的函数不用于下载软件包 。 insta

unexpected subsetting behavior after gathering with tidyr

What's going on here? Setup Create y1 and y2 , equivalent data.frames. y1 is generated using gather and y2 is read in directly. library(tidyr) x <- data.frame(id = 1:2, day_01 = as.POSIXct(c('2015-03-09', '1989-02-11')), day_02 = as.POSIXct(c('1985-09-11', '2000-08-15')), gender = factor(c("M", "F"))) y1 <- gather(x, key, value, d

与tidyr收集后的意外子集行为

这里发生了什么? 建立 创建y1和y2 ,等价的data.frames。 使用gather生成y1并直接读入y2 。 library(tidyr) x <- data.frame(id = 1:2, day_01 = as.POSIXct(c('2015-03-09', '1989-02-11')), day_02 = as.POSIXct(c('1985-09-11', '2000-08-15')), gender = factor(c("M", "F"))) y1 <- gather(x, key, value, day_01, day_02) y2 <- read.table(text="id

colSds does not work since the last matrixstats update in R

It seems like the colSds is not working since the last update in matrixStats (v0.10.0, 2014-06-07). It worked for me before, but now it returns an error message: Error: no applicable method for 'colCounts' applied to an object of class "data.frame" Here is an example: library(matrixStats) data(mtcars) colSds(mtcars) I use R version 3.1.0 (2014-04-10) on windows 7(x64). P

自从R中的最后一个matrixstats更新以来,colSds不起作用

自从matrixStats(v0.10.0,2014-06-07)上次更新以来,似乎colSds不工作。 它之前对我有用,但现在它返回一个错误信息: 错误:没有适用于'colCounts'的方法应用于类“data.frame”的对象 这里是一个例子: library(matrixStats) data(mtcars) colSds(mtcars) 我在Windows 7(x64)上使用R版本3.1.0(2014-04-10)。 平台:x86_64-w64-mingw32 / x64(64位)。 有没有人有线索出了什么问题,我该怎么办? 谢谢

ggplot wrap command text

I started to work with ggplot2 package and I encountered a problem. When I type in .R file: barGG <- ggplot(data4,aes(date,base), colour = factor(operator)) barGG + geom_point(aes(color = operator)) + geom_smooth(aes(color = operator),method = loess, size = 1) + facet_grid(. ~ city) + ggtitle("Operators TOM by city") + scale_colour_manual(values = cols) + myTheme everything works but if I

ggplot包装命令文本

我开始使用ggplot2软件包,并遇到了一个问题。 当我输入.R文件时: barGG <- ggplot(data4,aes(date,base), colour = factor(operator)) barGG + geom_point(aes(color = operator)) + geom_smooth(aes(color = operator),method = loess, size = 1) + facet_grid(. ~ city) + ggtitle("Operators TOM by city") + scale_colour_manual(values = cols) + myTheme 一切正常,但如果我在不同的行中键入相同的命令: barGG

Trouble with fig.env in knitr?

I'm having trouble getting fig.env to work in knitr. Here's a simple example: documentclass[12pt]{article} usepackage{rotfloat} begin{document} <<setup, include=F, cache=F>>= opts_chunk$set(comment=NA,fig.path=file.path(getwd(),'figure/minimal-'),tidy=F, fig.align='center',size='footnotesize') options(replace.assign=TRUE, width=60) @ Hoping for a sideways figure! <<

麻烦在knitr中使用fig.env?

我无法让fig.env在knitr中工作。 这里有一个简单的例子: documentclass[12pt]{article} usepackage{rotfloat} begin{document} <<setup, include=F, cache=F>>= opts_chunk$set(comment=NA,fig.path=file.path(getwd(),'figure/minimal-'),tidy=F, fig.align='center',size='footnotesize') options(replace.assign=TRUE, width=60) @ Hoping for a sideways figure! <<FIGURE, fig.env='sidewaysfigure'

ROauth on Windows using R, Invalid response after authorization

I'm using the below script in R, but when I redirect user to browser for oauth. and enter the PIN, it printing an error. Kindly help me out in this case. Thanks. cred=OAuthFactory$new(consumerKey="xxxxx",consumerSecret="xxxxx",requestURL="https://api.twitter.com/oauth/request_token",accessURL="https://api.twitter.com/oauth/authorize",authURL="https://api.twitter.com/oauth/access_token");

Windows上使用R的ROauth,授权后响应无效

我在R中使用下面的脚本,但是当我将用户重定向到oauth的浏览器时。 并输入PIN码,它会打印一个错误。 请在这种情况下帮助我。 谢谢。 cred=OAuthFactory$new(consumerKey="xxxxx",consumerSecret="xxxxx",requestURL="https://api.twitter.com/oauth/request_token",accessURL="https://api.twitter.com/oauth/authorize",authURL="https://api.twitter.com/oauth/access_token"); cred$handshake(cainfo="cacert.pem"); To

Convert column classes in data.table

I have a problem using data.table: How do I convert column classes? Here is a simple example: With data.frame I don't have a problem converting it, with data.table I just don't know how: df <- data.frame(ID=c(rep("A", 5), rep("B",5)), Quarter=c(1:5, 1:5), value=rnorm(10)) #One way: http://stackoverflow.com/questions/2851015/r-convert-data-frame-columns-from-factors-to-characters df &

转换data.table中的列类

我有一个使用data.table的问题:如何转换列类? 下面是一个简单的例子:使用data.frame我没有问题,用data.table转换它,我只是不知道如何: df <- data.frame(ID=c(rep("A", 5), rep("B",5)), Quarter=c(1:5, 1:5), value=rnorm(10)) #One way: http://stackoverflow.com/questions/2851015/r-convert-data-frame-columns-from-factors-to-characters df <- data.frame(lapply(df, as.character), stringsAsFactors=FALS

How to calculate wind direction from U and V wind components in R

I have U and V wind component data and I would like to calculate wind direction from these values in R. I would like to end up with wind direction data on a scale of 0-360 degrees, with 0° or 360° indicating a wind blowing to the north, 90° indicating a wind blowing to the east, 180° indicating a wind blowing to the south and 270° indicating a wind blowing to the west. Below is some example d

如何计算R中U和V风向的风向

我有U和V风分量数据,我想从R中的这些值计算风向。 我想最终得到0-360度的风向数据,0°或360°表示向北吹来的风,90°向东吹来的风,180°向风吹来的风南面和270°表示向西吹来的风。 以下是一些示例数据: > dput(wind) structure(list(u_ms = c(-3.711, -2.2417, -1.8188, -1.6164, -1.3941, -1.0682, -0.57611, -1.5698, -1.4976, -1.3537, -1.0901, -0.60403, -0.70812, -0.49045, -0.39849, 0.17875, 0.48356, 1.5082,