similar to: Explanation w.r.t. rbind, please!

Displaying 20 results from an estimated 10000 matches similar to: "Explanation w.r.t. rbind, please!"

2009 Oct 25
3
NULL elements in lists ... a nightmare
I can define a list containing NULL elements: > myList <- list("aaa",NULL,TRUE) > names(myList) <- c("first","second","third") > myList $first [1] "aaa" $second NULL $third [1] TRUE > length(myList) [1] 3 However, if I assign NULL to any of the list element then such element is deleted from the list: > myList$second <-
2011 Mar 11
5
How to calculate means for multiple variables in samples with different sizes
Hello R-helpers: I have data like this: sample replicate height weight age A 1.00 12.0 0.64 6.00 A 2.00 12.2 0.38 6.00 A 3.00 12.4 0.49 6.00 B 1.00 12.7 0.65 4.00 B 2.00 12.8 0.78 5.00 C 1.00 11.9 0.45 6.00 C 2.00 11.84 0.44 2.00 C 3.00 11.43 0.32 3.00 C 4.00 10.24 0.84 4.00 D
2002 Sep 09
1
reshape
Hi, I have a problem using the function 'reshape' for the following dataset: input: X Y Z T.U.1 T.U.2 T.V.1 T.V.2 1.00 1.00 A 24.94 24.74 34.65 35.33 1.00 3.00 A 26.03 25.87 25.76 26.12 1.00 1.00 B 24.76 24.63 34.34 34.48 1.00 3.00 B 26.15 25.98 25.96 25.66 2.00 1.00 A 24.40 24.26 34.55
2010 Jan 02
2
help with for loop
Dear useRs, I want to write a function that generates all the possible combinations of diff(). Example: If my vector has length 5, I need the diff() until lag=4 -> c(diff(my.vec), diff(my.vec, lag=2), diff(my.vec, lag=3), diff(my.vec, lag=4)) If it has length 4, I need until lag=3 -> c(diff(my.vec), diff(my.vec, lag=2), diff(my.vec, lag=3)) So, it must be until lag=(length(my.vec)-1).
2019 May 31
2
[patch] add sanity checks to quantile()
The attached patch adds some sanity checks to the "type" argument of quantile(). Output from the following commands show the change of behavior with the current patch: vec <- 1:10 quantile(vec, type = c(1, 2)) quantile(vec, type = 10) quantile(vec, type = "aaa") quantile(vec, type = NA_real_) quantile(vec, type = 4.3) quantile(vec, type = -1) Current behavior
2008 Dec 16
0
[LLVMdev] Another compiler shootout
On Tuesday 16 December 2008 01:03:36 Evan Cheng wrote: > FYI. http://leonardo-m.livejournal.com/73732.html > > If anyone is motivated, please file bugs for the losing cases. Also, > it might make sense to incorporate the tests into our nightly tester > test suite. FWIW, I just ported my ray tracer benchmark to C and found that llvm-gcc gives much worse performance than gcc on x86
2008 Mar 13
3
fast way to compare two matrices of combinations
I have a list (length 750), each element containing a vector of unique strings (unique gene ids), with length up to ~40 (median 15). I want to compile a matrix of all possible triplets and their frequency within gene elements. Using combn and a lot of looping, I am accomplishing this but it is VERY slow. I've tried to figure out a way to vectorize this, using "match" and
2008 Dec 24
3
Extract values based on indexes without looping?
Dear R-Helpers: I am a entry level user of R. Have the following question. Many thanks in advance. # value.vec stores values value.vec <- c('a','b','c') # which.vec stores the locations/indexs of values in value.vec. which.vec <- c(3, 2, 2, 1) # How can I obtain the following vector based on the value.vec and which.vec mentioned above # vector.I.want <-
2009 Feb 23
2
Formula that includes previous row values
Hi R users, Is there an easy way in R to generate the results table below using table 1 and the formula (simplified version of the real problem)? It would be easy if I knew the R equivalent of SAS's retain function, but could not find one. Thanks in Advance for any help! table1: ID X2 X3 1.00 1.00 0 2.00 0.00 3.00 1.00 4.00 3058 5.00 0.00 6.00 6.00 Formula: X3 = x2 + (.24 *
2002 Aug 21
1
is.numeric()
Dear R-list I am having troubles understanding how the function is.numeric() works. Any help appreciated. Some commands are given here (the output and my comments are given below) vec <- c(1.4, NA, NA, NA) sapply(vec,FUN=is.numeric) is.numeric(vec[2]) is.na(vec[2]) is.numeric(NA) vec <- c(TRUE, FALSE, NA, NA) sapply(vec,FUN=is.numeric) is.numeric(vec[2]) is.numeric(vec[3])
2008 Dec 23
1
quotation problem/dataframe names as function input argument.
Dear R friends: Can someone help me with the following problem? Many thanks in advance. # Problem Description: # I want to write functions which take a (character) vector of dataframe names as input argument. # For example, I want to extract the number of observations from a number of dataframes. # I tried the following: nobs.fun <- function (dframe.vec) { nobs.vec <-
2016 Aug 04
1
findInterval(all.inside=TRUE) for degenerate 'vec' arguments
What should findInterval(x,vec,all.inside=TRUE) return when length(vec)<=1, so there are no inside intervals? R-3.3.0 gives a decreasing map of x->output when length(vec)==1 and -1's when length(vec)==0. Would '0' in all those cases be better? > findInterval(x=c(10, 11, 12), vec=11, all.inside=TRUE, rightmost.closed=FALSE, left.open=FALSE) [1] 1 0 0 >
2011 Mar 21
3
How to substract a valur from dataframe with condition
Hello All, I need help with my dataframe, it is big but here I am using a small table as an example. My dataframe df looks like: X1 X2 X3 1 2011-02 0.00 96.00 2 2011-02 0.00 2.11 3 2011-02 2.00 3.08 4 2011-02 0.06 2.79 5 2011-02 0.00 96.00 6 2011-02 0.00 97.00 7 2011-02 0.08 2.23 I want values in columns X2 and X3 to be checked if they are greater than
2009 Sep 01
2
cbind objects using character vectors
Dear list, I have a character vector such vec.names<- c("a", "b") It happens that I have also two R objects called "a" and "b" that I would like to merge. Is it possible to do something like cbind(vec.names[1], vec.names[2]) ending up with the same result as cbind(a,b) Bellow is a reproducible example of what I need to to: dat<-
2018 Aug 05
2
MASS::boxcox "object not found"
Hi there, I wrote a function that wraps MASS::boxcox as: bc <- function(vec) { lam <- boxcox(lm(vec ~ 1)) lam <- lam$x[which.max(lam$y)] (vec^lam - 1)/lam } When I invoke it as: > x <- runif(20) > bc(x) Error in eval(predvars, data, env) : object 'vec' not found I have googled, and rewrote the above function as: bc <- function(vec) { dat <<-
2018 Aug 05
2
MASS::boxcox "object not found"
Hi there, I wrote a function that wraps MASS::boxcox as: bc <- function(vec) { lam <- boxcox(lm(vec ~ 1)) lam <- lam$x[which.max(lam$y)] (vec^lam - 1)/lam } When I invoke it as: > x <- runif(20) > bc(x) Error in eval(predvars, data, env) : object 'vec' not found I have googled, and rewrote the above function as: bc <- function(vec) { dat <<-
2010 Aug 30
1
Help With Post-hoc Testing
I am trying to do post-hoc tests associated with a repeated measures analysis with on factor nested within respondents. The factor (SOI) has 17 levels. The overall testing is working fine, but I can''t seem to get the multiple comparisons to work. The first step is to "stack" the data. Then I used "lme" to specify and test the overall model. Finally
2009 Sep 04
2
help with functions
Hi all, I have got 2 function (see bellow) which are simplifications of what I need to do. These functions are precisely the same, except for the last line. My question is, why doesn't function testA work in the same way as function testB. Both functions produce two objects, "a" and "b" that must merged with rbind. The difference is that in testA, I specify the name
2009 Jul 04
4
help with dealing with integer(0) returns from grep used within a conditional loop
I am using grep to locate colnames to automate a report build and have run into a problem when a colname is not found. The use of integer(0) in a conditional statement seems to be a no no as it has length 0. Below is a self-contained trivial example. I would like to get something like "NA" or -1 for the position when it is not found OR learn a way to use integer(0) or some
2002 Jul 09
3
Error handling
Hi I wrote a function implementing an algoritm for simulation of spatial sampling plans (using geoR). I'm using a range of parameters to perform several simulation and sometimes this parameters create function errors wich cause the algoritm to stop. How can I avoid this ? Below there's a small example that I made to study the problem but I was not able to solve it. I've tried