rdata

Can I access R data objects' attributes without fully loading objects from file?

一世执手 提交于 2019-11-29 17:04:11
Here's the situation. My R code is supposed to check whether existing RData files in application's cache are up-to-date. I do that by saving the files with names consisting of base64 -encoded names of a specific data element. However, data corresponding to each of these elements are being retrieved by submitting a particular SQL query per element, all specified in data collection's configuration file . So, in a situation when data for an element is retrieved, but afterwards I had to change that particular SQL query, data is not being updated. In order to handle this situation, I decided to use

Reading Rdata file with different encoding

被刻印的时光 ゝ 提交于 2019-11-29 10:01:54
I have an .RData file to read on my Linux (UTF-8) machine, but I know the file is in Latin1 because I've created them myself on Windows. Unfortunately, I don't have access to the original files or a Windows machine and I need to read those files on my Linux machine. To read an Rdata file, the normal procedure is to run load("file.Rdata") . Functions such as read.csv have an encoding argument that you can use to solve those kind of issues, but load has no such thing. If I try load("file.Rdata", encoding = latin1) , I just get this (expected) error: Error in load("file.Rdata", encoding = "latin1

Turning RData file into script files

假如想象 提交于 2019-11-29 03:03:29
问题 Is there a straightforward way to turn the functions of a .RData file into a normal code file (.R)? 回答1: Check out ?dump . For example: newEnv <- new.env() load("myFunctions.Rdata", newEnv) dump(c(lsf.str(newEnv)), file="normalCodeFile.R", envir=newEnv) You may also be interested in ?prompt (which creates documentation files for objects) and / or ?package.skeleton . 回答2: This recent blog post addresses a basically the same problem: http://www.r-statistics.com/2010/09/dumping-functions-from

Can I access R data objects' attributes without fully loading objects from file?

蓝咒 提交于 2019-11-28 11:03:16
问题 Here's the situation. My R code is supposed to check whether existing RData files in application's cache are up-to-date. I do that by saving the files with names consisting of base64 -encoded names of a specific data element. However, data corresponding to each of these elements are being retrieved by submitting a particular SQL query per element, all specified in data collection's configuration file . So, in a situation when data for an element is retrieved, but afterwards I had to change

Importing data into R (rdata) from Github

江枫思渺然 提交于 2019-11-27 23:51:31
I want to put some R code plus the associated data file (RData) on Github. So far, everything works okay. But when people clone the repository, I want them to be able to run the code immediately. At the moment, this isn't possible because they will have to change their work directory (setwd) to directory that the RData file was cloned (i.e. downloaded) to. Therefore, I thought it might be easier, if I changed the R code such that it linked to the RData file on github. But I cannot get this to work using the following snippet. I think perhaps there is some issue text / binary issue. x <- RCurl:

How to save data file into .RData?

走远了吗. 提交于 2019-11-27 17:19:53
I want to save data into an .RData file. For instance, I'd like to save into 1.RData with two csv files and some information. Here, I have two csv files 1) file_1.csv contains object city[[1]] 2) file_2.csv contains object city[[2]] and additionally save other values, country and population as follows. So, I guess I need to make objects 'city' from two csv files first of all. The structure of 1.RData may looks like this: > data = load("1.RData") > data [1] "city" "country" "population" > city [[1]] NEW YORK 1.1 SAN FRANCISCO 3.1 [[2]] TEXAS 1.3 SEATTLE 1.4 > class(city) [1] "list" > country [1

How to save data file into .RData?

梦想的初衷 提交于 2019-11-27 04:11:59
问题 I want to save data into an .RData file. For instance, I'd like to save into 1.RData with two csv files and some information. Here, I have two csv files 1) file_1.csv contains object city[[1]] 2) file_2.csv contains object city[[2]] and additionally save other values, country and population as follows. So, I guess I need to make objects 'city' from two csv files first of all. The structure of 1.RData may looks like this: > data = load("1.RData") > data [1] "city" "country" "population" > city

Loading .RData files into Python

不羁岁月 提交于 2019-11-27 01:04:50
问题 I have a bunch of .RData time-series files and would like to load them directly into Python without first converting the files to some other extension (such as .csv). Any ideas on the best way to accomplish this? 回答1: People ask this sort of thing on the R-help and R-dev list and the usual answer is that the code is the documentation for the .RData file format. So any other implementation in any other language is hard++ . I think the only reasonable way is to install RPy2 and use R's load

How to see data from .RData file?

大城市里の小女人 提交于 2019-11-27 01:00:27
I saw some similar qestions and I tried to work it out on my own, but I couldn't. This is my problem: I have to load a isfar.RData file to use it in other computation (which are not important to describe here). And I would like to simply see how looks data in this isfar.RData file e.g. what numbers, columns, rows it carries. First I load my file: isfar<-load("C:/Users/isfar.RData") When I try to obtain this information (I'm using Rcmdr) by ls() function or marking isfar at the beginning after loading I get in the output window: [1] "isfar" instead of the table. Why? Thanks a lot, I appreciate

How can I load an object into a variable name that I specify from an R data file?

强颜欢笑 提交于 2019-11-26 23:57:45
When you save a variable in an R data file using save , it is saved under whatever name it had in the session that saved it. When I later go to load it from another session, it is loaded with the same name, which the loading script cannot possibly know. This name could overwrite an existing variable of the same name in the loading session. Is there a way to safely load an object from a data file into a specified variable name without risk of clobbering existing variables? Example: Saving session: x = 5 save(x, file="x.Rda") Loading session: x = 7 load("x.Rda") print(x) # This will print 5.