小编SFu*_*n28的帖子

ggplot2 - geom_ribbon bug?

这段代码抛出一个错误,我无法弄清楚为什么......

library( plyr )
library( ggplot2 )
library( grid )
library( proto )

# the master dataframe
myDF = structure(list(Agg52WkPrceRange = c(2L, 2L, 2L, 2L, 2L, 2L, 3L, 
5L, 3L, 5L, 3L, 5L, 3L, 2L, 3L, 3L, 3L, 3L, 2L, 2L, 2L, 2L, 2L, 
3L, 3L, 3L, 3L, 3L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
3L, 3L, 3L, 4L, 3L, 4L, 3L, 4L, 4L, 4L, 4L), OfResidualPntReturn52CWk = c(0.201477324, 
0.22350293, 0.248388728, 0.173871456, 0.201090654, 0.170666183, 
0.18681883, …
Run Code Online (Sandbox Code Playgroud)

r ggplot2

2
推荐指数
1
解决办法
3830
查看次数

无法安装RJSONIO库

我在安装RJSONIO时遇到了一些麻烦.install.packages告诉我该软件包不适用于我的R版本.我可以手动下载二进制文件并安装,但之后我无法使用该库,因为它"未安装为'arch = x64'"

解决方法?

> install.packages('RJSONIO')
Installing package(s) into ‘C:/R/site-library’
(as ‘lib’ is unspecified)
Warning in install.packages :
  package ‘RJSONIO’ is not available (for R version 2.13.0)
>
> install.packages( "C:\\downloads\\RJSONIO_0.7-2.zip" , repos = NULL )
Installing package(s) into ‘c:/R/site-library’
(as ‘lib’ is unspecified)
package 'RJSONIO' successfully unpacked and MD5 sums checked
>
> library(RJSONIO)
Error: package 'RJSONIO' is not installed for 'arch=x64'
Run Code Online (Sandbox Code Playgroud)

r cran

2
推荐指数
1
解决办法
4135
查看次数

as.Date.numeric需要Linux中的原点,而不是Windows.固定?

as.Date(10000)在Windows中运行良好,但在Linux发行版上它出错:'origin' must be supplied.Windows安装有某种默认来源?我正在尝试构建/检查最初在Windows机器上开发的Linux上的软件包.该软件包省略了origin所有地方的参数.有快速解决方案吗?也许是Rprofile.site的补充?

r

2
推荐指数
1
解决办法
450
查看次数

简洁的方法来测试X是否在Y +/-小容差范围内?

是否有一种简洁的方法来测试某个数字X是否在另一个数字Y的范围内加上或减去一些小的容差?

r

2
推荐指数
1
解决办法
141
查看次数

使R安装自包含/独立于用户

我试图让R忽略c:\ users \ name \ documents并完全独立/可移植

这是我的目录结构:

.../R/R-2.1.2.2/...
.../R/r_user/
.../R/libs_site/
Run Code Online (Sandbox Code Playgroud)

我更新了Rprofile.site如下:

# Set the working directory
setwd( file.path( R.home() , ".." , "r_user" ) )

# set the home directory
Sys.setenv(HOME=file.path( R.home() , ".." , "r_user" )  )

# Set the site library folder
.Library.site = file.path( R.home() , ".." , "libs_site" )
Run Code Online (Sandbox Code Playgroud)

当R启动时,我运行.libPaths(),但仍然看到c:/ users / ...

因此,也许R不是按照上面的Sys.setenv更新?解决方案?

r shared-libraries

1
推荐指数
1
解决办法
4194
查看次数

变量名限制为256个字节

roxygenize在以下代码上失败,并显示以下错误消息.关于该主题的其他帖子表明存在错位的字符.我找不到任何错误!你能发现这个问题吗?

#' My Title. My Description
#'
#' @return A n x n \code{\link{matrix}} where n = the number of variables.  Row and column names are in the same order and are equivalent to the variable names in \samp{timeSeriesData}.  Each entry [i,j] in the matrix is the covariance between variable i and variable j.
#' @callGraphPrimitives
#' @note some notes here
MyFunc = function( timeseriesData ,  method , decayFactor  )
{
}


Error in do.call(paste, c(trimmed.lines, sep = "\n")) : …
Run Code Online (Sandbox Code Playgroud)

r roxygen

1
推荐指数
1
解决办法
616
查看次数

用R - 黑盒范式预测lm对象

我有一个返回lm对象的函数.我想根据一些新数据生成预测值.新数据是一个data.frame,其格式与传递给lm函数的数据完全相同,只是响应已被删除(因为我们正在预测,而不是训练).我希望执行以下操作,但得到一个错误:

predict( model , newdata )
"Error in eval(expr, envir, enclos) : object 'ModelResponse' not found"
Run Code Online (Sandbox Code Playgroud)

就我而言,ModelResponse是我最初训练的数据中响应列的名称.所以只是为了踢,我试图插入NA响应:

newdata$ModelResponse = NA
predict( model , newdata )
Error in terms.default(object, data = data) : no terms component nor attribute
Run Code Online (Sandbox Code Playgroud)

非常令人沮丧!R的模型/回归概念与我的不匹配:1.我用一些数据训练模型并获得模型对象.2.我可以从任何环境/功能/框架等中获取新数据.只要我将数据输入到"看起来像"我训练过的数据的模型对象中(即相同的列名).这是一个标准的黑盒范例.

所以这是我的问题:
1.我在这里缺少什么概念?
2.如何让我的场景工作?
3.如何使模型对象可移植?str(model)告诉我模型对象保存了它训练的原始数据!所以模型对象是庞大的.我希望我的模型可以移植到任何功能/环境/等.并且只包含分数所需的数据.

r

1
推荐指数
1
解决办法
3230
查看次数

双匹配data.frame

我想在data.frame上进行双重匹配以提取行索引.例如,在下面的data.frame中,我想先匹配match1,并且在match1的每个元素中,我想匹配match2.把它想象成一个双重排序(首先按名称,然后按日期),除了我没有排序,我匹配

test = data.frame( name = c( "bob" , "jane","adam","jane" ,"bob" , "adam" ) , date = as.Date(c(1,2,2,1,2,1)))
match1 = c( "jane" , "adam", "bob")
match2 = c( as.Date(c(2,1)))
result = c( 2,4,3,6,5,1 )
Run Code Online (Sandbox Code Playgroud)

r

1
推荐指数
1
解决办法
441
查看次数

格式数字,不带前导零

格式化数字的最佳方法是什么,以便它不显示前导零.例如:

test = .006
sprintf/format/formatC( ??? )  # should result in ".006"
Run Code Online (Sandbox Code Playgroud)

r

1
推荐指数
1
解决办法
1636
查看次数

当sql server级联更新并取消操作时会发生什么?

当我更新某个表的值时,列级联更新到许多其他表(并且其他表具有强制在该列上引用完整性的外键)并取消操作?整个操作是作为交易处理还是回滚?我正在从Sql Management Studio取消.

sql-server sql-server-2005

0
推荐指数
1
解决办法
126
查看次数