similar to: wrapper for save function

Displaying 20 results from an estimated 10000 matches similar to: "wrapper for save function"

2007 Nov 09
2
wrapper for coxph with a subset argument
Dear R-help - Thanks to those who replied yesterday (Christos H. and Thomas L.) regarding my question on coxph and model formula, the answers worked perfectly. My new question involves the following. I want to run several coxph models (package survival) with the same dataset, but different subsets of that dataset. I have found a way to do this, described below in functions subwrap1 and
2007 Nov 08
2
mapply, coxph, and model formula
Hello - I am wanting to create some Cox PH models with coxph (in package survival) using different datasets. The code below illustrates my current approach and problem with completing this. ### BEGIN R SAMPLE CODE ############################## library(survival) #Define a function to make test data makeTestDF <- function(n) { times <- sample(1:200, n, replace = TRUE) event
2009 Mar 20
4
how to make aggregation in R ?
Hi, I am trying to aggregate the sum of my test data.frame as follow: testDF <- data.frame(v1 = c("a", "a", "a", "a", "a", "b", "b", "b", "b", "b", "c", "c", "c", "c", "c", "d", "d", "d", "d",
2013 Dec 16
1
External pointers and changing SEXPTYPE
Dear Developers, I've been struggling through writing R extension in C. I've been using an external pointer to store my data (please see sample below). I encountered a very weird erroneous behaviour: when I tried to use my external pointer to a structure holding several types of data, including SEXPs, I discovered that SEXPs change their types between returning from initialization
2009 Sep 16
3
apply function across two variables by mult factors
Greetings, I am attempting to run a function, which produces a vector and requires two input variables, across two nested factor levels. I can do this using by(X, list(factor1, factor2), function), however I haven't found a simple way to extract the list output into an organized vector form. I can do this using nested loops but it isn't exactly an optimal approach. Thank you
2016 Dec 15
1
Parallel compression support for saving to rds/rdata files?
Hi, I have tried to follow the instructions in the ``save`` documentation and it doesn't seem to work (see below): mydata <- do.call(rbind, rep(iris, 10000)) con <- pipe("pigz -p8 > fname.gz", "wb"); save(mydata, file = con); close(con) # This runs R.utils::gunzip("fname.gz", "fname.RData", overwrite = TRUE) load("fname.RData") #
2010 Jul 08
2
Loading .Rdata within an R function
Colleagues: I am having trouble loading data from within .Rdata file within the environment of a function. That is, the following always loads to the global environment: f1 <- function() { load("mydata.Rdata") # compute with objects from mydata.Rdata. } I wish to load mydata.Rdata only within the function f1. Perhaps I have misunderstood
2007 Jun 24
2
matlab/gauss code in R
Hi all! I would like to import a matlab or gauss code to R. Could you help me? Bye, Sebasti?n. 2007/6/23, r-help-request en stat.math.ethz.ch <r-help-request en stat.math.ethz.ch>: > Send R-help mailing list submissions to > r-help en stat.math.ethz.ch > > To subscribe or unsubscribe via the World Wide Web, visit >
2011 Mar 09
2
SQLDF - Submitting Queries with R Objects as Columns
Fellow R programmers, I'd like to submit SQLDF statements with R objects as column names. For example, I want to assign "X" to "var1" (var1<-"X") and then refer to "var1" in the SQLDF statement. SQLDF needs to understand that when I reference "var1", it should look for "X" in the dataframe. This is necessary because my SQLDF
2011 Jan 01
3
Retrieving Factors with Levels Ordered
Hello (and Happy New Year), When I create a factor with labels in the order I want, write the data as a text file, and then retrieve them, the factor levels are no longer in the proper order. Here is what I do (I tried many variations): # educ is a numeric vector with 1,001 observations. # There is one NA # Use educ to create a factor feducord <- factor(educ, labels = c('Elem',
2009 Jun 22
1
Problem with storing a sequence of lmer() model fit into a list
Dear R-helpers: May I ask a question related to storing a number of lmer model fit into a list. Basically, I have a for-loop (see towards the bottom of this email) in the loop, I am very sure that the i-th model fit (i.e.,fit_i) is successfully generated and the character string (i.e., tmp_i) is created correctly. The problem stems from the following line in the for-loop #trouble making line
2007 Dec 19
1
Different labels by panel in barchart
Dear all, I'm analysing a survey, and creating a barchart of the different responses for each question. The questions are grouped according to a number of categories, so I'm using lattice to create a plot with each question in a category on it. The problem is that the response set for different questions within the same category varies. I want to be able to draw only the relevant
2009 Feb 20
2
Grouped bwplots?
Dear list, I am sorry for asking you this, but I am trying to do again what I thought I have done before, although this time it does not work. So, given the data set: > testdf <- data.frame(grfak=sample(c("One","Two"),size=100,replace=TRUE), panfak= sample(c("Yes","No"),size=100,replace=TRUE), xfak=
2011 May 17
1
Dealing with null values Aggregate function
Hi R users I trying to some aggregate statistics on a very large dataset. The null values are causing a problem. I would like to calculate aggregate values for groups. I am just no sure how to deal with the "" I would ideally like them to ignored ie if there is only 1 value over several columns than that value would be the summary statistic. I have put the following example together to
2008 Apr 03
1
by "infelicity"
Dear list, Please find below an example of odd behaviour of the by function. It occurs both under GNU/Linux R 2.6.2 and Windows R 2.7.0alpha. Respective sessionInfo()'s are given below. I hope I do not overlook anything. testFactor <- factor(sample(LETTERS[1:6], size = 42, replace = TRUE)) testMatrix <- matrix(rnorm(42 * 6), nrow = 42) testDf <- as.data.frame(testMatrix) by(data
2012 May 03
6
Cannot read or write to file in Linux Ubuntu
I am the proud owner of a new laptop since my old one died the other day. Currently I have a dual-boot Windows 7 Home and Ubuntu 12.04 . I'll leave the Windows problems for another post. I know practically nothing about Linux so I am probably doing something stupid but ... at the moment I cannot seem read or write files in Ubuntu. I am not having any problem saving other documents to the
2009 Apr 24
2
argument 'exclude' in function xtabs
Dear all I was willing to use argument 'exclude' in function xtabs to remove some levels of factors (xtabs help page says '"exclude: a vector of values to be excluded when forming the set of levels of the classifying factors"). I tried: > mydata <- data.frame( treatment = c("B", "A", "C", "C", "B",
2004 Feb 08
1
APE: compar.gee( )
Dear all, I don't understand the following behaviour: Running compar.gee (in library ape ) with and without the option 'data', it give me different results Example: .... Start R .... > load("eiber.RData") > ls() [1] "gee.na" "mydata" "mytree" > library(ape) > # runnig with the option data= mydata > compar.gee(alt ~ R,
2006 Mar 24
1
Subdirectory 'data' contains no data sets.
Hi R CMD check is giving me the following error * checking package subdirectories ... WARNING Subdirectory 'data' contains no data sets. This is not true. That subdirectory contains the file myData.Rdata (I have tried .rda format too, same result). There is also a myData.Rd in the man subdirectory. If I remove the .Rd and the data directory R CMD check executes normally. I am using
2010 Apr 26
1
Help with replacement of certain values in dataset with SAS code equivalent
I am new to R and have tried for a good while to figure out how to code this in R. The dataset below: FTIStandKey State County FTITract CoverType Ver_CT V_Origin V_SpGrp NAH6005-001 Texas Jasper NAH6005 PPLB-2000-U PPLB-2000-U P P NAH6005-002 Texas Jasper NAH6005 NHHX-1950-O NHHX-1950-I N H NAH6253-001 Texas Tyler NAH6253 PPLB-2001-U PPLB-2001-U P P