Can I load an RData file while bypassing loading the namespaces?

Let's say some of my users cannot alter their R environments, but I need them to be able to open up RData files. These environment files require a package to be loaded (httpuv to be exact). We don't care about the package, we don't need its capabilities, we just need to get at the data. Is there a way to either force R to bypass loading namespaces when loading the RData file, or fo

我可以加载RData文件而绕过加载名称空间吗?

假设我的一些用户不能改变他们的R环境,但我需要他们能够打开RData文件。 这些环境文件需要加载一个包(确切地说httpuv)。 我们不关心软件包,我们不需要它的功能,我们只需要获取数据。 有没有办法强制R在加载RData文件时绕过加载名称空间,或者强制R在原始端没有名称空间相关性的情况下保存它? 谢谢。 要重现,请安装Shiny。 从Shiny applet中创建一些R对象并将其保存到服务器的文件系统中作为RData文件。 将文件复

Cleaning mixed decimal separators after Excel import (gsub maybe?)

I needed to read several Excel files and used the gdata package. Unfortunately the files were formated lazily, some with "," decimal/thousand separators some with "." and some with none. To get you an idea, the numbers can look like this: #Five Times 1000.1 and four times 1000.0 x <- c("1,000.1","1.000.1","1000.1","1000,1","1.000,1","1000","1,000","1.000","1000.0") x

Excel导入后清理混合十进制分隔符(gsub也许?)

我需要阅读几个Excel文件并使用gdata包。 不幸的是,这些文件是懒洋洋地编写的,有些用“,”十进制/千分隔符,一些用“。”。 有的没有。 为了给你一个想法,数字可以像这样: #Five Times 1000.1 and four times 1000.0 x <- c("1,000.1","1.000.1","1000.1","1000,1","1.000,1","1000","1,000","1.000","1000.0") x 有没有一种通用的方法分别将它们转换为1000.1和1000.0? 我想过使用gsub()和一个正则表达式。 第一

convert raw data file to RData file

I am trying to make a RData file from a raw numeric space deliminated text file, ie 11 33 55 22 33 45 25 78 00 44 87 99 .... I have another R script which needs to load this new RData file and perform linear regression with the data using mapreduce (rhipe). Thus when i save this RObject I need to read it back this way: data <- strsplit(unlist(map.values)," ") #so that I can run regressio

将原始数据文件转换为RData文件

我正在尝试从原始数字空间删除文本文件,即,使RData文件 11 33 55 22 33 45 25 78 00 44 87 99 .... 我有另一个R脚本需要加载这个新的RData文件,并使用mapreduce(rhipe)对数据进行线性回归。 因此,当我保存这个RObject时,我需要以这种方式读取它: data <- strsplit(unlist(map.values)," ") #so that I can run regression like: y<- unlist(lapply(data,"[[",1)) x1<-unlist(lapply(data,"[[",2)) x2<-

Updating an existing Rdata file

I have found myself in the position of needing to update one or two data objects in an Rdata file previously created using save . If I'm not careful to load the file I can forget to re-save some objects in the file. As an example, I'm working on a package with some objects stored in sysdata.rda (look-up tables for internal use which I do not want to export) and only want to worry about

更新现有的Rdata文件

我发现自己需要更新先前使用save创建的Rdata文件中的一个或两个数据对象。 如果我不小心加载文件,我可以忘记重新保存文件中的一些对象。 作为一个例子,我正在处理一些存储在sysdata.rda对象(我不想导出用于内部使用的查找表),只想更新单个对象。 我还没有设法确定是否有一个标准的方法来做到这一点,所以创建了我自己的功能。 resave <- function (..., list = character(), file = stop("'file' must be specified"

Grouping functions (tapply, by, aggregate) and the *apply family

Whenever I want to do something "map"py in R, I usually try to use a function in the apply family. However, I've never quite understood the differences between them -- how { sapply , lapply , etc.} apply the function to the input/grouped input, what the output will look like, or even what the input can be -- so I often just go through them all until I get what I want. Can someon

分组函数(tapply,by,aggregate)和* apply family

每当我想在R中做一些“映射”py时,我通常会尝试在apply系列中使用函数。 但是,我从来没有完全理解它们之间的差异 - 如何将输入/分组输入应用到函数,输出将会是什么样子,甚至输入什么样的东西,所以{ sapply , lapply等}我经常只是经历他们,直到我得到我想要的。 有人可以解释如何使用哪一个? 我目前(可能不正确/不完整)的理解是...... sapply(vec, f) :输入是一个向量。 输出是一个向量/矩阵,其中元素i是f(vec

What ways are there to edit a function in R?

Let's say we have the following function: foo <- function(x) { line1 <- x line2 <- 0 line3 <- line1 + line2 return(line3) } And that we want to change the second line to be: line2 <- 2 How would you do that? One way is to use fix(foo) And change the function. Another way is to just write the function again. Is there another way? (Remember, the t

有什么方法可以编辑R中的函数?

假设我们有以下功能: foo <- function(x) { line1 <- x line2 <- 0 line3 <- line1 + line2 return(line3) } 而且我们希望将第二行更改为: line2 <- 2 你会怎么做? 一种方法是使用 fix(foo) 并改变功能。 另一种方法是再次写入函数。 有另一种方法吗? (记住,任务是改变第二行) 我想以某种方式将函数表示为字符串的向量(以及字符),然后更改其中一个值,然后再次将其

Error compiling Rnw to tex

I had a problem using function Sweave . It seemed to be an encoding problem because I did not specify any encoding like: usepackage[latin1]{inputenc}. Now using button "Compile PDF" works -> PDF is generated and everythink is OK. But I'm getting 30 warnings and 18 badboxes. Using function Sweave to generate first the tex file fails with this message: Error: chunk 4 (label

将Rnw编译为tex时出错

使用Sweave函数时出现问题。 这似乎是一个编码问题,因为我没有指定任何编码,如: usepackage [latin1] {inputenc}。 现在使用按钮“Compile PDF”工作 - >生成PDF并且每个方面都可以。 但我得到30个警告和18个坏箱。 使用函数Sweave首先生成tex文件失败,并显示以下消息: Error: chunk 4 (label = t4) Error in file(con, "w") : cannot open the connection In addition: There were 31 warnings (use warnings() to

Create annotation for a balloon plot from gplots package

I was wondering if it is possible to change the rows and columns annotation of a balloon plot generated by the gplots package. Assuming my data are a subset of the mtcars dataset data(mtcars) dt <- as.table(as.matrix(mtcars[1:10,])) I can make the balloon plot as follows library("gplots") balloonplot(t(dt), xlab ="", ylab="", label = FALSE, show.margins = FALSE) Can I change the color of

从gplots包创建气球图的注释

我想知道是否可以更改由gplots包生成的气球图的行和列注释。 假设我的数据是mtcars数据集的一个子集 data(mtcars) dt <- as.table(as.matrix(mtcars[1:10,])) 我可以如下制作气球图 library("gplots") balloonplot(t(dt), xlab ="", ylab="", label = FALSE, show.margins = FALSE) 我可以用任意颜色更改灰色条的颜色(对于x和y)吗? 例如,我想要红,蓝,绿,蓝,蓝,绿,蓝,蓝,绿,蓝,蓝三种颜色。 这可能吗?

Non linear regression by levels of several groups in R

Take the example of mtcars in R: I want to make a non linear regression for the relationship between mpg and disp with: nls(data=mtcars, mpg ~ A * disp^2 + B * disp + C, start=list(A=1,B=1,C=1)) But, I need to analyse the relationship for every combination of cyl, gear and carb. I tried to do this : nlsList(data=mtcars, mpg ~ A * disp^2 + B * disp + C | cyl * gear * carb,

非线性回归的几个级别在R

以R中的mtcars为例:我想对mpg和disp之间的关系进行非线性回归: nls(data=mtcars, mpg ~ A * disp^2 + B * disp + C, start=list(A=1,B=1,C=1)) 但是,我需要分析cyl,gear和carb的每种组合的关系。 我试图做到这一点: nlsList(data=mtcars, mpg ~ A * disp^2 + B * disp + C | cyl * gear * carb, start=list(A=1,B=1,C=1)) 但我总是有错误。 最后的目标是用cyl,ge

dplyr masks GGally and breaks ggparcoord

Given a fresh session, executing a small ggparcoord(.) example provided in the documentation of the function library(GGally) data(diamonds, package="ggplot2") diamonds.samp <- diamonds[sample(1:dim(diamonds)[1], 100), ] ggparcoord(data = diamonds.samp, columns = c(1, 5:10)) results into the following plot: Again, starting in a fresh session and executing the same script with the loaded dp

dplyr掩盖GGally并打破ggparcoord

给定一个新的会话,执行函数文档中提供的一个小ggparcoord(。)示例 library(GGally) data(diamonds, package="ggplot2") diamonds.samp <- diamonds[sample(1:dim(diamonds)[1], 100), ] ggparcoord(data = diamonds.samp, columns = c(1, 5:10)) 结果如下图所示: 再次,从新鲜的会话开始,并使用加载的dplyr执行相同的脚本 library(GGally) library(dplyr) data(diamonds, package="ggplot2") diamonds.samp <-