similar to: Using character vectors to call data in the "cbind" command

Displaying 20 results from an estimated 40000 matches similar to: "Using character vectors to call data in the "cbind" command"

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<-
2012 May 23
3
applying cbind (or any function) across all components in a list
#If I have two lists as follows a1<- array(1:6, dim=c(2,3)) a2<- array(7:12, dim=c(2,3)) l1<- list(a1,a2) a3<- array(1:4, dim=c(2,2)) a4<- array(5:8, dim=c(2,2)) l2<- list(a3,a4) #how can I create a new list with the mean across all arrays within the list, so all components are included? As an example for [[1]]; cbind((l1[[1]][,1]+l2[[1]][,1])/2,
2008 Mar 13
2
How to cbind or rbind different lengths vectors/arrays without repeating the elements of the shorter vectors/arrays ?
Hi, How to cbind or rbind different lengths vectors/arrays without repeating the elements of the shorter vectors/arrays ? > cbind(1:2, 1:10) [,1] [,2] [1,] 1 1 [2,] 2 2 [3,] 1 3 [4,] 2 4 [5,] 1 5 [6,] 2 6 [7,] 1 7 [8,] 2 8 [9,] 1 9 [10,] 2 10 [[alternative HTML version deleted]]
2010 Sep 07
2
repeated measurements ANOVA
Dear list, i am setting up a GLM for a repeated measurement ANOVA using the lm and ANOVA function. my design contains four factors with 5, 5, 2 and 2 (= 14) levels, respectively. the data are stored in a data.frame with six columns, one for the data themselves and the remainings for the factors where strings indicate the factor levels in each row. now i would like to restructure this
2010 Jun 09
2
cbind with vectors of different lengths?
Hello R help I have a dataframe, with 71 samples (rows) and 30 variables. I got linear models for some of the variables,? and I want to join fitted and residuals of these models to the data frame. Sometimes, these vectors have the same length of the dependant variable, but in a few cases, NA values can be found on my data, and therefore, both fitted and residuals have a few rows less than the
2004 Jul 08
2
Getting elements of a matrix by a vector of column indice s
See if the following helps: > m <- outer(letters[1:5], 1:4, paste, sep="") > m [,1] [,2] [,3] [,4] [1,] "a1" "a2" "a3" "a4" [2,] "b1" "b2" "b3" "b4" [3,] "c1" "c2" "c3" "c4" [4,] "d1" "d2" "d3" "d4" [5,]
2009 Sep 08
1
cbind formula definition
Hi there, I have the following problem: I have a package called "polLCA" which has the following syntax: poLCA(formula, data) and needs the following formula definition: formula <- cbind(V1,V2,V3,...) So far so good. What I tried now was the following: #Get "data" with the "read.table" fuction data <- read.table("d:/ .....) #Select cols to use in the
2008 Dec 22
2
... (dotMethods) and cbind/rbind: how to give the signature?
Dear List, I'm struggling with the signature writing cbind/rbind functions for a S4 class. First of all, I'm very happy that it is now possible to dispatch on ... I follow the example for "paste" in ?dotMethods, which works as far as this: ### start example setClass ("cbtest", representation = representation (data = "data.frame"),
2011 Jul 14
2
cbind in aggregate formula - based on an existing object (vector)
Hello! I am aggregating using a formula in aggregate - of the type: aggregate(cbind(var1,var2,var3)~factor1+factor2,sum,data=mydata) However, I actually have an object (vector of my variables to be aggregated): myvars<-c("var1","var2","var3") I'd like my aggregate formula (its "cbind" part) to be able to use my "myvars" object. Is it
2012 Jul 10
1
cbind and cbind.data.frame
## Hi, I'm having trouble understanding how the cbind function decides what method to apply to its arguments. Easy cut and paste code below. > > > > ## create two columns > c1 <- c("A","A","B","B") > c2 <- 1:4 > > ## cbind outputs a matrix with elements that are characters, seems reasonable > out <-
2009 Sep 22
3
converting a character vector to a function's input
Hi all, I have been trying to solve this problem and have had no luck so far. I have numeric vectors VAR1, VAR2, and VAR3 which I am trying to cbind. I also have a character vector "VAR1,VAR2,VAR3". How do I manipulate this character vector such that I can input a transformed version of the character vector into cbind and have it recognize that I'm trying to refer to my numeric
2009 Mar 13
2
Taking diff of character vectors
Hello, everybody Say I have nm1 <- c(rep(1,10), rep(0,10)) then I can do: diff(nm1) to see where I have shift in value but what if I have nm2 <- c(rep("SPZ8", 10), rep("SPX9", 10)) how can I produce the same ouput as diff(nm1) does, that is zeros everywhere except for one place where SPZ8 changes to SPX9 (there should be 1 there)? What if I have a matrix of characters
2008 Dec 03
1
reduce limit number of arguments in methods:::cbind
Dear all, As far as I understand, the number of arguments in methods:::cbind is limited by the "self recursive" construction of the function which generates nested loops. A workaround could be to use the internal cbind function on blocks of non S4 objects. The limitation would then be reduced to the number of consecutive S4 objects. ##### R code ##### dfr <- data.frame(matrix(0,
2003 Jul 29
2
cbind/rbind inconsistency with NULL parameter (PR#3585)
R-Version: 1.7.1 (2003-06-16) OS: Debian/GNU Linux cbind and rbind handle NULL parameters inconsistently. Consider: > cbind() NULL > cbind(NULL) NULL And: > cbind(diag(x = 1, 1, 1)) [,1] [1,] 1 > cbind(NULL, diag(x = 1, 1, 1)) [,1] [1,] 1 These seem to indicate that NULL parameters will be ignored in any call to cbind and rbind. However: >
2013 Jul 23
1
cbind error with check.names
Here is an example where?cbind?fails with an error when?check.names=TRUE?is set. data(airquality) airQualityBind =cbind(airquality,airquality,check.names =TRUE) ?I understand that?cbind?is a call to?data.frame?and the following works: airQualityBind =data.frame(airquality,airquality,check.names =TRUE) but I would like to understand why?cbind?throws an error. I asked this question on SO here:
2011 Nov 10
2
library(qpcR) cbind.na
I want to use function cbind.na at library(qpcR) I install package qpcR and I can use functions such m1 <- pcrfit(reps, 1, 2, l5) > AICc(m1) [1] -102.5843 but when i try cbind.na(1, 1:7) i take message Error: could not find function "cbind.na" Thanks -- View this message in context: http://r.789695.n4.nabble.com/library-qpcR-cbind-na-tp4023339p4023339.html Sent from the
2006 Jun 06
2
Strange behaviour of cbind
Hi, Is this intended behaviour of cbind? > a<-c(0,1,2,3) > a [1] 0 1 2 3 > a<-as.ordered(a) > a [1] 0 1 2 3 Levels: 0 < 1 < 2 < 3 > a<-a[a!=0] #remove the zero from a > a [1] 1 2 3 Levels: 0 < 1 < 2 < 3 > cbind(a) a [1,] 2 [2,] 3 [3,] 4 #cbind adds +1 to each element > a<-as.ordered(as.vector(a)) > a [1] 1 2 3 Levels: 1 < 2 <
2010 Feb 09
1
cbind(deparse.level=2,...) problems
Should the deparse.level=2 argument to cbind and rbind be abandoned? It is minimally documented, not used in any CRAN package, and causes some problems. E.g., (a) If a matrix input has row names but not column names cbind(deparse.level=2,...) stops. > m<-matrix(11:14,nrow=2,ncol=2,dimnames=list(Row=c("R1","R2"),Col=charact er())) > cbind(m, 101:102,
2007 Oct 31
2
cbind()
Hello, I would like to use the cbind() function to construct a matrix used in the middle of a function as following for (i in 1:1000) { b[i] <- function(cbind(a[[1]][[i]], a[[2]][[i]],a[[3]][[i]],...a[[67]][[i]])) } Is there an easy way of achieving this rather than "cbind" every column? -- View this message in context: http://www.nabble.com/cbind%28%29-tf4724534.html#a13507633
2010 Jul 12
2
cbind in for loops
I have 30 files in the current directories, i would like to perform the cbind(fil1,file2,file3,file4....file30) how could i do this in a for loop: such as: file2 <- list.files(pattern=".out3$") for (j in file2) { cbind(j).......how to implement cbind here } Thanks. -- View this message in context: