similar to: quoting expressions in a list

Displaying 20 results from an estimated 20000 matches similar to: "quoting expressions in a list"

2006 Apr 04
1
Indexing a vector by a list of vectors
Hello R-help - I have vec <- c("string1", "string2", "string3") ind <- list(c(1,2),c(1,2,3)) I want "vec" indexed by each vector in the list "ind". The first element of the list I want would be vec[c(1,2)], the second element would be vec[c(1,2,3)], like the following. [[1]] [1] "string1" "string2" [[2]] [1]
2008 Jul 02
1
Hmisc latex function with longtable option
Hello - I'm trying to use Hmisc's latex function to produce a postscript file of a data.frame, using the longtable = TRUE option. When I run, for example, ## sample R code dvips(latex(data.frame(a = rnorm(100), b = rnorm(100)), longtable = TRUE), file = "test.ps") latex runs successfully and a test.ps file is produced. However, I see the following in the
2008 May 16
2
Integer / floating point question
Dear R-help - I have thought about this question for a bit, and come up with no satisfactory answer. Say I have the numeric vector t1, given as t1 <- c(1.0, 1.5, 2.0, 2.5, 3.0) I simply want to reliably extract the unique integers from t1, i.e., the vector c(1, 2, 3). This is of course superficially simple to carry out. However, my question is related to R FAQ 7.31, "Why
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 Aug 31
4
Offtopic, HT vs. HH in coin flips
Dear R-help, Could someone please try to explain this paradox to me? What is more likely to show up first in a string of coin tosses, "Heads then Tails", or "Heads then Heads"? ##generate 2500 strings of random coin flips ht <- replicate(2500, paste(sample(c("H", "T"), 100, replace = TRUE), collapse =
2008 Feb 26
1
wrapper for save function
Hello - I would like to create a wrapper to the 'save' function in the base package, but have a small problem with the name of the object that is getting saved in the file. Below is a simple example illustrating my problem. ## BEGIN SAMPLE R CODE ################################################## ## Here is the wrapper for the save function
2010 Mar 22
1
summary.formula and continuous variables
Hello, I am using the summary.formula function in the Hmisc package to produce tables. With the "method" argument set to "response", the help says, "Continuous independent variables (see the ?continuous? parameter below) are automatically stratified into ?g? (see below) quantile groups". By my reading, this makes it impossible to summarize a continuous variable
2009 Oct 21
5
News on R "s largest corporate partner REVolution Computing and SPSS CEO:
Start the REvolution without me... http://danesecooper.blogs.com/divablog/2009/10/start-the-revolution-without-me.html *From Danese Cooper's Blog* Some of you may have become aware of REvolution Computing<http://revolution-computing.com/>, a commercial open source company organized around the R Language<http://www.r-project.org/>, when I joined in March
2010 Nov 08
7
How to rbind list of vectors with unequal vector lengths?
Hi, How to rbind these vectors from a list?: > l <- list(a = c(1, 2), b = c(1, 2, 3)) > l $a [1] 1 2 $b [1] 1 2 3 > do.call(rbind, l) [,1] [,2] [,3] a 1 2 1 b 1 2 3 Warning message: In function (..., deparse.level = 1) : number of columns of result is not a multiple of vector length (arg 1) > -J
2008 May 22
2
grid error message when resizing graphics window after tcltk loaded
Dear R-devel / Dr. Murrell - This is similar but ultimately unrelated (I think) to something I posted about in February. See my original post here: https://stat.ethz.ch/pipermail/r-devel/2008-February/048278.html I start R with the --vanilla option, and run the following code. ## BEGIN SAMPLE R CODE library(grid) for(i in seq(0, 1, by = .1)) { for(j in seq(0, 1, by = .1)) { angle
2010 Feb 02
1
R's X11 Device Properties
Hello, This is an issue that is at the interface of R, X, and my window manager (either icewm or openbox, both latest versions). I am running R 2.10.1 on Ubuntu 9.10. My goal: When an X11 device is started in R (e.g., by simply calling plot), I would like for the resulting window to be in the "always on top" state, and for focus not to switch to it. Configuring this behavior is
2010 Jun 29
1
read.table / type.convert with NA values
Hello, While assisting a fellow R-helper off list, I narrowed down an issue he was having to the following behavior of type.convert, called through read.table. This is using R 2.10.1, if newer versions don't exhibit this behavior, apologies. # generates numeric vector > type.convert(c("123.42", "NA")) [1] 123.42 NA # generates a numeric vector, notice the
2008 Feb 05
2
Error in grid.text after tcltk package loaded
Hello - I am noticing some strange errors when using the grid package, but (apparently) only after loading the tcltk package. The interaction here does not make sense to me, and I'm wondering if anyone else can reproduce this, or if it is specific to my setup. Here is my sessionInfo: sessionInfo() R version 2.6.2 RC (2008-02-04 r44332) i686-pc-linux-gnu locale:
2009 Jul 30
4
edit.row.names taking row names from the edited dataframe
Hi all, I am struggling to work out how to use the rownames from an edited dataframe rather than the row names from the original dataframe. In my data set i'm trying to extract several rows of data on particular individuals, i don't doubt i'm using the long way round but what i have in the way of a script is this: ##selecting the IDs from the dataframe individually
2010 May 23
4
creating a reverse geometric sequence
Hello, Can anyone think of a non-iterative way to generate a decreasing geometric sequence in R? For example, for a hypothetical function dg, I would like: > dg(20) [1] 20 10 5 2 1 where I am using integer division by 2 to get each subsequent value in the sequence. There is of course: dg <- function(x) { res <- integer() while(x >= 1) { res <- c(res, x) x
2006 Oct 03
1
developing a package with a name space
Hello - I'm currently maintaining an R package that uses a name space, and am also starting a new R package that will use a name space. According the the R News June 2003 issue, "Adding a name space to a package may complicate debugging code ... it is a good idea not to add a name space to a package until it is completely debugged, and to remove the name space if further debugging
2009 Sep 29
3
creating Surv object from character vector
Hello, I have srv <- Surv(sample(1:10), sample(0:1, 10, replace = TRUE)) srv [1] 1 10 2+ 8 6+ 7+ 3 5+ 4+ 9+ srv.char <- as.character(srv) srv.char [1] " 1 " "10 " " 2+" " 8 " " 6+" " 7+" " 3 " " 5+" " 4+" " 9+" Is there an inverse to as.character(srv). That is, I would
2008 Oct 07
4
sort a list?
I am trying to sort a list and the data is obiously not in the right format. I am trying: x <- list() x[["A"]] <- 1 x[["B"]] <- 2 order(x) But am getting: Error in order(x) : unimplemented type 'list' in 'orderVector1' How should I change the list so that it can be sorted? What kinds of objects (classes of objects) can be sorted? Thank you. Kevin
2011 Apr 08
7
Where is the tcltk package?
Perhaps I'm being even thicker than usual, but I can't find the tcltk package on CRAN. There is a tcltk2 package, which says that it is a collection of supplements to tcltk, but I cannot see a just-plain tcltk anywhere. If I try to install tcltk2 (from the Linux command line, or using install.packages() in R) it complains that it needs tcltk. If I try to install tcltk using