Re: [R] cbind or ?

2010-01-15 Thread Henrique Dallazuanna
Try this: `class<-`(lapply(1:length(QuanImpUnsold), function(idx)c(QuanImpUnsold[[idx]], PARCELS[[idx]])), "by") On Fri, Jan 15, 2010 at 5:06 PM, L.A. wrote: > > > Hey Guys, >  It sure seems I get stuck on things that should be easy. > Heres my question: > > PARCELS<-by(ResImp[ , "ACCOUNTNO"], R

[R] cbind or ?

2010-01-15 Thread L.A.
Hey Guys, It sure seems I get stuck on things that should be easy. Heres my question: PARCELS<-by(ResImp[ , "ACCOUNTNO"], ResImp["Property"], length) > PARCELS Property: UNSOLD [1] 9053 --- Property: SOL

Re: [R] Cbind() on the right-side of a formula in xYplot()

2009-10-27 Thread Dylan Beaudette
On Monday 26 October 2009, Frank E Harrell Jr wrote: > Dylan Beaudette wrote: > > Hi, > > > > Using the latest rms package I am able to make nice plots of model > > predictions +/- desired confidence intervals like this: > > > > # need this > > library(rms) > > > > # setup data > > d <- data.frame(

Re: [R] Cbind() on the right-side of a formula in xYplot()

2009-10-26 Thread Frank E Harrell Jr
Dylan Beaudette wrote: Hi, Using the latest rms package I am able to make nice plots of model predictions +/- desired confidence intervals like this: # need this library(rms) # setup data d <- data.frame(x=rnorm(100), y=rnorm(100)) dd <- datadist(d) options(datadist='dd') # fit model l <- o

[R] Cbind() on the right-side of a formula in xYplot()

2009-10-26 Thread Dylan Beaudette
Hi, Using the latest rms package I am able to make nice plots of model predictions +/- desired confidence intervals like this: # need this library(rms) # setup data d <- data.frame(x=rnorm(100), y=rnorm(100)) dd <- datadist(d) options(datadist='dd') # fit model l <- ols(y ~ rcs(x), data=d) #

Re: [R] cbind formula definition

2009-09-09 Thread Biedermann, Jürgen
Super! It works. :-) Thanks a lot, you both. Greetings Jürgen Petr PIKAL schrieb: > Hi > r-help-boun...@r-project.org napsal dne 09.09.2009 10:07:49: > > >> Hi Henrique, >> >> Thanks for your reply. >> I tried you suggestion but it didn't work with the poLCA package. >> >> Maybe i didn't exp

Re: [R] cbind formula definition

2009-09-09 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 09.09.2009 10:07:49: > Hi Henrique, > > Thanks for your reply. > I tried you suggestion but it didn't work with the poLCA package. > > Maybe i didn't express myself good. > > The normal syntax is: > > f <- cbind(V1,V2,V3)~1 > poLCA(f,data) You compl

Re: [R] cbind formula definition

2009-09-09 Thread Biedermann, Jürgen
Hi Henrique, Thanks for your reply. I tried you suggestion but it didn't work with the poLCA package. Maybe i didn't express myself good. The normal syntax is: f <- cbind(V1,V2,V3)~1 poLCA(f,data) and what I wanna do is kind of use an expression to automatically generate the "V1,V2,V3" argume

Re: [R] cbind formula definition

2009-09-08 Thread Henrique Dallazuanna
I don't understand the cbind(bi) sintax, but you can do this with the folowing: (Using iris data from R) form <- formula(paste(paste(names(iris), collapse = " + "), "~ 1")) 2009/9/8 "Biedermann, Jürgen" > Hi there, > > I have the following problem: > > I have a package called "polLCA" which has

[R] cbind formula definition

2009-09-08 Thread Biedermann, Jürgen
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" fuct

Re: [R] cbind objects using character vectors

2009-09-02 Thread jonas garcia
Thanks Erik and Henrique, That's what I was after. Jonas On Tue, Sep 1, 2009 at 8:08 PM, Henrique Dallazuanna wrote: > Try this: > > > sapply(vec.names, get) > > But for this example, you don't need for, try: > > > dat - 1 > > On Tue, Sep 1, 2009 at 2:52 PM, jonas garcia < > garcia.jona...@g

Re: [R] cbind objects using character vectors

2009-09-01 Thread Henrique Dallazuanna
Try this: > sapply(vec.names, get) But for this example, you don't need for, try: > dat - 1 On Tue, Sep 1, 2009 at 2:52 PM, jonas garcia wrote: > 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 wo

Re: [R] cbind objects using character vectors

2009-09-01 Thread Erik Iverson
-project.org Subject: [R] 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

[R] cbind objects using character vectors

2009-09-01 Thread jonas garcia
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 reproduci

Re: [R] cbind

2009-04-14 Thread Luc Villandre
Hi Emma, Here's what I suggest: na.vec = is.na(A[,1]) ; first.num.pos = min(which(na.vec==FALSE)) ; first.part = (-first.num.pos+1):(-1) ; second.part = 0:(length(A[,1])-length(first.part)-1) ; Result.mat = cbind(c(first.part,second.part),A[,1]) ; I hope this is what you wa

Re: [R] cbind

2009-04-14 Thread Dimitris Rizopoulos
Yes, indeed! Best, Dimitris Mike Lawrence wrote: Unfortunately Dimitris' solution fails in the face of NA padding on both sides of the numeric data, as in Emma's original example. x <- c(rep(NA, 20), sample(100, 25), rep(NA,20)) On Tue, Apr 14, 2009 at 9:40 AM, Dimitris Rizopoulos wrote:

Re: [R] cbind

2009-04-14 Thread Mike Lawrence
Unfortunately Dimitris' solution fails in the face of NA padding on both sides of the numeric data, as in Emma's original example. x <- c(rep(NA, 20), sample(100, 25), rep(NA,20)) On Tue, Apr 14, 2009 at 9:40 AM, Dimitris Rizopoulos wrote: > try this: > > x <- c(rep(NA, 20), sample(100, 25)) >

Re: [R] cbind

2009-04-14 Thread Mike Lawrence
oops, of course I meant: a=c(NA,NA,2,3,NA,NA,NA) b=1:length(a) cbind(b=b-which.min(is.na(a)),a=a) On Tue, Apr 14, 2009 at 9:43 AM, Mike Lawrence wrote: >> a=c(NA,NA,2,3,NA,NA,NA) >> which.min(is.na(a)) > [1] 3 >> b=1:length(a) >> b-3 > [1] -2 -1  0  1  2  3  4 >> cbind(b=b-3,a=a) >       b  a >

Re: [R] cbind

2009-04-14 Thread Mike Lawrence
> a=c(NA,NA,2,3,NA,NA,NA) > which.min(is.na(a)) [1] 3 > b=1:length(a) > b-3 [1] -2 -1 0 1 2 3 4 > cbind(b=b-3,a=a) b a [1,] -2 NA [2,] -1 NA [3,] 0 2 [4,] 1 3 [5,] 2 NA [6,] 3 NA [7,] 4 NA On Tue, Apr 14, 2009 at 7:20 AM, emj83 wrote: > > I have a list of numbers with NAs as

Re: [R] cbind

2009-04-14 Thread Dimitris Rizopoulos
try this: x <- c(rep(NA, 20), sample(100, 25)) n.na <- sum(is.na(x)) cbind(seq(-n.na, length(x) - n.na - 1), x) I hope it helps. Best, Dimitris emj83 wrote: I have a list of numbers with NAs as below: A[,1] [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA [1

[R] cbind

2009-04-14 Thread emj83
I have a list of numbers with NAs as below: > A[,1] [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA [19] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA [37] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA [55] NA

Re: [R] cbind(NULL,zoo.object)?

2009-03-15 Thread Gabor Grothendieck
I've just committed a fix to the zoo svn repository. You can grab it like this: source("http://r-forge.r-project.org/plugins/scmsvn/viewcvs.php/*checkout*/pkg/R/merge.zoo.R?rev=575&root=zoo";) On Sun, Mar 15, 2009 at 2:54 AM, Ajay Shah wrote: > Folks, > > I often build up R objects starting fro

[R] cbind(NULL,zoo.object)?

2009-03-14 Thread Ajay Shah
Folks, I often build up R objects starting from NULL and then repeatedly using rbind() or cbind(). This yields code like: a <- NULL for () { onerow <- craft one more row a <- rbind(a, onerow) } This works because rbind() and cbind() are forgiving when presented with a NULL arg: they act like

[R] Cbind help

2008-09-19 Thread Rajasekaramya
Hi there I want to cbind a vector(contains 20 values) to a dataframe containg (18 rows).The missing value in the dataframe is however a repeated values but still i want to retain the repeats in the vector and the dataframe values can even get enterd twice. how should i go about it Example: Vec

Re: [R] cbind in data.frame

2008-08-25 Thread Prof Brian Ripley
I think the issue is that cbind applied to a vector or matrix drops classes. It seems that data.frame() should have been used to combine columns here. On Mon, 25 Aug 2008, Charles Plessy wrote: Le Sun, Aug 24, 2008 at 10:56:43PM -0700, Yuan Jian a écrit : hi, when I used cbind to combine col

Re: [R] cbind in data.frame

2008-08-25 Thread Yuan Jian
lt;[EMAIL PROTECTED]> Subject: Re: [R] cbind in data.frame To: r-help@r-project.org Date: Monday, August 25, 2008, 6:09 AM Le Sun, Aug 24, 2008 at 10:56:43PM -0700, Yuan Jian a écrit : > hi, > when I used cbind to combine columns, some contents of columns has been replaced by > number

Re: [R] cbind in data.frame

2008-08-24 Thread Charles Plessy
Le Sun, Aug 24, 2008 at 10:56:43PM -0700, Yuan Jian a écrit : > hi, > when I used cbind to combine columns, some contents of columns has been > replaced by > number. in the script below, column should be aaa,bbb,ccc but I was given > 1,2,3. > but when I change the column to vector, it gave me cor

[R] cbind in data.frame

2008-08-24 Thread Yuan Jian
hi, when I used cbind to combine columns, some contents of columns has been replaced by number. in the script below, column should be aaa,bbb,ccc but I was given 1,2,3. but when I change the column to vector, it gave me correct contents. can you please tell me why?   > d<-read.table("aaa.txt") >

Re: [R] cbind help

2008-07-18 Thread Henrique Dallazuanna
Try: names(abc)[3] <- "w" On Fri, Jul 18, 2008 at 1:08 PM, Rajasekaramya <[EMAIL PROTECTED]> wrote: > > hi there, > > I need to change a column name in a dataframe.how do i do that > eg > abc<- dataframe > abc > x y z > > i wanna change the colum z to w. > > Ramya > -- > View this message in con

[R] cbind help

2008-07-18 Thread Rajasekaramya
hi there, I need to change a column name in a dataframe.how do i do that eg abc<- dataframe abc x y z i wanna change the colum z to w. Ramya -- View this message in context: http://www.nabble.com/cbind-help-tp18532609p18532609.html Sent from the R help mailing list archive at Nabble.com. _

Re: [R] cbind results to original data frame

2008-05-29 Thread ONKELINX, Thierry
-Oorspronkelijk bericht- Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Namens Ingrid Tohver Verzonden: donderdag 29 mei 2008 3:23 Aan: r-help@r-project.org Onderwerp: [R] cbind results to original data frame I have the following script, which gives me a prediction for each of my observations

[R] cbind results to original data frame

2008-05-28 Thread Ingrid Tohver
I have the following script, which gives me a prediction for each of my observations (> 49k), and subsets my data frame by site (n = 183): ts <- (by(dem16,dem16['Site'],function(dat) try(predict(nls(Tw ~ mu + ((alpha - mu)/ (1 + exp(gamma*(B - Mean_air

Re: [R] cbind and mean by week

2008-03-26 Thread jim holtman
Is this what you want? You have to add "na.rm=TRUE" to the calculations: > week<-c(28,28,28,28,28,28,28,29,29,29,29,29,29,29,30,30,30,30,30,30,30) > td<-c(0.015,0.012,NA,0.015,NA,0.014,0.014,0.013,0.013,0.013,0.013,NA,0.010,0.013,0.015,0.011,0.014,0.014,0.014,0.014,0.016) > pd<-c(0,0,NA,80,NA,45,

[R] cbind and mean by week

2008-03-25 Thread Felipe Carrillo
Hi: I have been able to finally crunch my data by importing it by week(thank you all for your help),but here we go again.. Now I'am trying to do it for the the whole year. Since the dataset is huge I'm only making a 3 weeks dataframe. - I want to get the mean of pd by week - I want to count the

Re: [R] cbind function

2007-11-13 Thread Jens Oehlschlägel
And here is a second solution, that differs in what happens if the variables have differing lengths: > var1 <- 1:4 > var2 <- 1:3 > sapply(ls(patt="^var[0-9]"), get) $var1 [1] 1 2 3 4 $var2 [1] 1 2 3 > do.call("cbind", lapply(ls(patt="^var[0-9]"), get)) [,1] [,2] [1,]11 [2,]2

Re: [R] cbind function

2007-11-13 Thread Henrique Dallazuanna
Try this: sapply(ls(patt="^var[0-9]"), get) On 13/11/2007, livia <[EMAIL PROTECTED]> wrote: > > Hello everyone, > > I would like to use the "cbind" function to construct a dataset, combining > some variable I defined before. > The codes are something like > > var1 <- ... > var2 <- ... > var2 <- .

[R] cbind function

2007-11-13 Thread livia
Hello everyone, I would like to use the "cbind" function to construct a dataset, combining some variable I defined before. The codes are something like var1 <- ... var2 <- ... var2 <- ... ... data <- cbind(var1,var2,var3...) The problem is I would like some flexibity in the data, i.e. the numbe

Re: [R] cbind()

2007-10-31 Thread Duncan Murdoch
On 10/31/2007 8:06 AM, livia wrote: > 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 wa

Re: [R] cbind()

2007-10-31 Thread Henrique Dallazuanna
Hi Perhaps: Hi, Try this: do.call("rbind", lapply(a, function(x)do.call("cbind", x))) On 31/10/2007, livia <[EMAIL PROTECTED]> wrote: > > > 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] <-

Re: [R] cbind()

2007-10-31 Thread Henrique Dallazuanna
Or just: sapply(a, function(x)do.call("cbind", x)) If is what you want. On 31/10/2007, Henrique Dallazuanna <[EMAIL PROTECTED]> wrote: > > Hi > Perhaps: > > Hi, > > Try this: > > do.call("rbind", lapply(a, function(x)do.call("cbind", x))) > > On 31/10/2007, livia <[EMAIL PROTECTED]> wrote: > >

[R] cbind()

2007-10-31 Thread livia
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? --

<    1   2