[R] repeating rows in R

2010-07-27 Thread Andrew Anglemyer
I'm somewhat a new user and have been trying to figure out how to repeat rows a certain number of time based on a variable. Currently, the number of rows is not reflective of the number of observations. To get the number of observations (n=22 in this case), I have to multiply by the variable NoRe

Re: [R] repeating rows in R

2010-07-27 Thread Andrew Anglemyer
newDat >x freq > 1 12 > 1.1 12 > 2 23 > 2.1 23 > 2.2 23 > 3 34 > 3.1 34 > 3.2 34 > 3.3 34 > > > > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] >

[R] problem with rbind when data frame contains an date-time variable "POSIXt" "POSIXlt"

2011-02-17 Thread Andrew Anglemyer
I'm trying to rbind two data frames, both with the same columns names. One of the columns is a variable with date-time and this variable is causing the rbind to fail--giving the error "Error in names(value[[jj]])[ri] <- nm : 'names' attribute [7568] must be the same length as the vector [9]" Is

Re: [R] problem with rbind when data frame contains an date-time variable "POSIXt" "POSIXlt"

2011-02-17 Thread Andrew Anglemyer
16:25:00 > 3 3 2009-08-13 08:30:00 > 4 4 2009-08-25 10:25:00 > 5 5 2009-08-10 06:20:00 > 6 6 2009-10-09 08:20:00 > > > > No problems. > > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of Andr

[R] combining two columns into one column despite NAs

2011-02-24 Thread Andrew Anglemyer
I am trying to combine two columns in a data frame into one column. Some values in either column are missing, but not in the same row for the two different columns. Additionally, when both columns in a row contain data, the data are identical. I want a new column with the identical data or the d

Re: [R] combining two columns into one column despite NAs

2011-02-24 Thread Andrew Anglemyer
" 2 2"b" "b" "b" 3 3"c" "c""c" 4 4 NA "d" "d" Thanks again! On Thu, Feb 24, 2011 at 4:27 PM, Ista Zahn wrote: > I think the easiest way is pro

Re: [R] combining two columns into one column despite NAs

2011-02-24 Thread Andrew Anglemyer
Thanks for all the solutions! On Thu, Feb 24, 2011 at 5:37 PM, Sarah Goslee wrote: > What about: > > ifelse(is.na(x), y, x) > > as long as x and y are always the same where one is not NA. > > Sarah > > On Thu, Feb 24, 2011 at 7:53 PM, Andrew Anglemyer > wrote: >