similar to: Help in defining vectors

Displaying 20 results from an estimated 40000 matches similar to: "Help in defining vectors"

2009 Oct 26
1
defining number of samples
dear all i am trying to perform t-test (t.test) in R here i am putting the commands and answer i got > t.test(Ht_cm[from_treeline=='above'][type=='SD'],Ht_cm[from_treeline=='below'][type=='SD']) Welch Two Sample t-test data: Ht_cm[from_treeline == "above"][type == "SD"] and Ht_cm[from_treeline == "below"][type ==
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]
2010 Jan 18
2
function to set log(0)=0 not working on tables or vectors
There must be a very basic thing I am not getting... I'm working with some entropy functions and the convention is to use log(0)=0. So I wrote a function: llog<-function(x){ if (x ==0) 0 else log(x) } which seems to work fine for individual numbers e.g. >llog(0/2) [1] 0 but if I try whole vectors or tables: p<-c(4,3,1,0) q<-c(2,2,2,2) llog(p/q) I get this: [1] 0.6931472
2006 Oct 09
1
dump (PR#9282)
Full_Name: Ricardo Ehlers Version: 2.4.0 OS: Linux Submission from: (NULL) (200.138.34.134) The dump function is outputing something different from previous versions. For example > a <- c(1,2,3); dump('a',file='test') now results in `a` <- c(1,2) instead of "a" <- c(1,2) in the file 'test' This prevents using the bayesmix package and running JAGS
2010 Jan 15
1
Lattice: How to color the data points in splom() according to the panel they are plotted?
Dear ExpeRts, I have the scatter plot matrix as given below. I would like the different "sub-plots" in the scatter plot matrix to be colored differently. How do I get all points shown in the upper-left plot (on position (1,1) in the scatter plot matrix) to be plotted in blue, and the points shown in the plot to the right (on position (1,2) in the scatter plot matrix) to be plotted in
2010 Jul 06
3
Conditional Splitting a Vectors into Two Vectors
Suppose I have two vectors of same dimensions: x <-c(0.49534,0.80796,0.93970,0.99998) count <-c(0,33,0,4) How can I group the vectors 'x' into two vectors: 1. Vector `grzero` that contain value in x with `count` value greater than 0 and 2. Vector `eqzero` with value in x with `count` value equal to zero. Yielding > print(grzero) > [1] 0.80796 0.99998
2010 Apr 30
1
Trouble using Ecdf () from the Hmisc library
Hello: [Kindly Cc when replying] The question in a nutshell is this: Is there a more robust alternative to Ecdf ()? The details: I've used Ecdf () _a lot_ over the past few years and I have learned to live with its warnings. But I am running short on time and patience now [*] Here is a reproducible example: > library (Hmisc) > x <- read.csv ( file =
2010 Jan 02
1
suppress output for meta in package tm
Hello, I am using the tm package and wish to suppress the output for meta. I am defining another variable for one of the tags and don't want the value printed on the screen. Any help would be appreciated. Thanks. here is the commnad: n_corp_file <- meta(corpa[[n]], "URI") -Amber [[alternative HTML version deleted]]
2002 Jul 08
2
Methods/package for working with sets and intervals
Before reinventing the wheel, is there a package for working on (nice) sets and intervals, where one can for instance check if a set of intervals contains a scalar, taking the union and intersection of some intervals etc? Example: # Defining the set i = [1,2) + [3.5, 10] i <- c(1,2, 3.5, 10) attr(i, "include") <- c(TRUE, FALSE, TRUE, TRUE) x <- 0:12 # Get
2011 Jan 11
2
aggregate.formula implicitly removes rows containing NA
The documentation for `aggregate` makes it sound like aggregate.formula should behave identically to aggregate.data.frame (apart from the way the parameters are passed). But it looks like aggregate.formula is quietly removing rows where any of the "output" variables (those on the LHS of the formula) are NA. This differs from how aggregate.data.frame works. Is this expected behavior?
2010 Dec 07
2
robustbase problem [bug?] in adjbox function.
hello list, i'm a bit puzzled by the error message i get when i copy past this in R:
2010 Sep 27
1
bwplot superpose panel.points from another dataframe
Hi everybody, using bwplot for producing panel boxplot with 3 dimensions i want to add a mark on each boxplot representing one individual (on all its dimensions) till now, i didn't succeed getting the desired solution I want as well to keep the median symbols as a line Many thanks for your help christophe here is the tested code: ######################## library(lattice) ex <-
2010 Feb 09
3
Confusing error message for [[.factor (PR#14209)
Full_Name: George Russell Version: 2.10.0 and 2.11.0 Under development (unstable) (2010-02-08 r51108) OS: Windows Submission from: (NULL) (217.111.3.131) > c("a","b")[[c(TRUE,FALSE)]] Error in `[[.default`(factor(c("a", "b")), c(TRUE, FALSE)) : recursive indexing failed at level 1 I find this error message confusing, though after reading the HELP
2011 Mar 29
4
Creating 3 vectors that sum to 1
I have 3 vectors: p1, p2, and p3. I would like each vector to be any possible value between 0 and 1 and p1 + p2 + p3 = 1. I want to graph these and I've thought about using scatterplot3d(). Here's what I have so far. library(scatterplot3d) p1 <- c(1,0,0,.5,.5,0,.5,.25,.25,.34,.33,.33,.8,.1,.1,.9,.05,.05) p2 <- c(0,1,0,.5,0,.5,.25,.5,.25,.33,.34,.33,.1,.8,.1,.05,.9,.05) p3 <-
2012 Mar 30
4
list assignment syntax?
Dear R wizards: is there a clean way to assign to elements in a list? what I would like to do, in pseudo R+perl notation is f <- function(a,b) list(a+b,a-b) (c,d) <- f(1,2) and have c be assigned 1+2 and d be assigned 1-2. right now, I use the clunky x <- f(1,2) c <- x[[1]] d <- x[[2]] rm(x) which seems awful. is there a nicer syntax? regards, /iaw ---- Ivo Welch
2005 Aug 27
2
Defining an ex-gaussian PDF
How does one define PDFs as yet undefined in R, such as the ex- gaussian, the sum of two RVs, one exponential, one Gaussian? The PDF would then be the convolution of an exponential PDF, dexp(), and a normal, dnorm(). Kindly cc me in your reply to r-help. Thanks, _____________________________ Professor Michael Kubovy University of Virginia Department of Psychology USPS: P.O.Box 400400
2007 Nov 15
2
how to extract the elements of a list of vectors in a fixed position?
Hi, How is it possible to extract athe elements of a list of vectors in a fixed position? suppose that I have a list of 2-element vectors, how can I extract the 2nd element of all vectors in the list? Can it be done with indexing and not by element name? Thanks carol So in this example, I want to extract 2 and 4 v = list (c(1,2), c(3, 4)) > v [[1]] [1] 1 2 [[2]] [1] 3 4
2009 Oct 19
1
Defining S3-methods for S4-objects: cannot coerce type 'S4' to vector of type 'integer'
In the 'doBy' package there is an esticon() function for calculating linear contrasts for various model types. I have defined an S3-method 'esticon.mer()' for 'mer' objects from the lme4 package. Building the package and invoking the method gives: > esticon(fm1, c(1,1)) Confidence interval ( WALD ) level = 0.95 Error in as.integer(x) : cannot coerce type 'S4'
2012 Jan 11
3
turning a list of vectors into a data.frame (as rows of the DF)?
As a newer R practicioner, it seems I stump myself weekly (at least) with issues that have spinning my wheels.  Here is yet another... I'm trying to turn a list of numeric vectors (of uneual length) inot a dataframe.  Each vector held in the list represents a row, and there are some rows of unequal length.  I would like NAs as placeholders for "missing" data in the shorter vectors. 
2009 Dec 11
3
`mgp[1:3]' are of differing sign (PR#14130)
Full_Name: Cornell Gonschior Version: 2.10.0 OS: Linux Submission from: (NULL) (212.201.28.40) Hi, in the introduction to R, you can find the following sentence in the par() chapter: "Use tck=0.01 and mgp=c(1,-1.5,0) for internal tick marks." I thought that's nice, because I wanted to have tick marks and tick labels inside and the axis title outside. But: > plot(z, las=1,