Re: [R] combine barchart and xyplot in lattice

2023-11-18 Thread Naresh Gurbuxani
I converted to factor because, in barchart, x-axis seems to be factor only. Without factor, x labels are 1, 2, 3, … Solution 1 works for me. If there is a method for barchart, I am interested in looking at that as well. Thanks, Naresh Sent from my iPhone > On Nov 18, 2023, at 10:09 AM, Deepa

Re: [R] combine barchart and xyplot in lattice

2023-11-18 Thread Deepayan Sarkar
On Sat, 18 Nov 2023 at 06:44, Naresh Gurbuxani wrote: > > In below graph, I would like to add two vertical lines using > panel.abline(). Is this possible? I assume you want the 'v' variable in panel.abline() to be interpreted in the context of your x-axis, which here represents a factor variable

[R] combine barchart and xyplot in lattice

2023-11-18 Thread Naresh Gurbuxani
In below graph, I would like to add two vertical lines using panel.abline().  Is this possible? Thanks, Naresh mydf <- data.frame(hour = rep(6:20, 2), traffic = c(round(dnorm(6:20, 9, 3) * 1), round(dnorm(6:20, 17, 4) * 1)), direction = rep(c("inbound", "outbound"), c(15, 15))) vehicles

Re: [R] Combine two dataframe with different row number and interpolation between values

2022-08-30 Thread PIKAL Petr
9 AM > To: r-help@r-project.org > Subject: [R] Combine two dataframe with different row number and > interpolation between values > > Dear all, > I am trying to combine two large dataframe in order to make a dataframe with > exactly the dimension of the second dataframe

Re: [R] Combine two dataframe with different row number and interpolation between values

2022-08-30 Thread PIKAL Petr
l Message- > From: R-help On Behalf Of javad bayat > Sent: Wednesday, August 31, 2022 8:09 AM > To: r-help@r-project.org > Subject: [R] Combine two dataframe with different row number and > interpolation between values > > Dear all, > I am trying to combine two large dataf

Re: [R] combine filter() and select()

2020-08-20 Thread Hadley Wickham
On Wed, Aug 19, 2020 at 10:03 AM Ivan Calandra wrote: > > Dear useRs, > > I'm new to the tidyverse world and I need some help on basic things. > > I have the following tibble: > mytbl <- structure(list(files = c("a", "b", "c", "d", "e", "f"), prop = > 1:6), row.names = c(NA, -6L), class = c("tbl_d

Re: [R] combine filter() and select()

2020-08-20 Thread Martin Morgan
A kind of hybrid answer is to use base::subset(), which supports non-standard evaluation (it searches for unquoted symbols like 'files' in the code line below in the object that is its first argument; %>% puts 'mytbl' in that first position) and row (filter) and column (select) subsets > mytbl

Re: [R] combine filter() and select()

2020-08-19 Thread Ivan Calandra
Hi Jeff, The code you show is exactly what I usually do, in base R; but I wanted to play with tidyverse to learn it (and also understand when it makes sense and when it doesn't). And yes, of course, in the example I gave, I end up with a 1-cell tibble, which could be better extracted as a length-

Re: [R] combine filter() and select()

2020-08-19 Thread Ivan Calandra
9 (0) 2631 9772-243 https://www.researchgate.net/profile/Ivan_Calandra On 19/08/2020 19:21, Chris Evans wrote: > Inline > > - Original Message - >> From: "Ivan Calandra" >> To: "R-help" >> Sent: Wednesday, 19 August, 2020 16:56:32 >> Subject: [R] combine f

Re: [R] combine filter() and select()

2020-08-19 Thread Jeff Newmiller
The whole point of dplyr primitives is to support data frames... that is, lists of columns. When you pare your data frame down to one column you are almost certainly using the wrong tool for the job. So, sure, your code works... and it even does what you wanted in the dplyr style, but what a po

Re: [R] combine filter() and select()

2020-08-19 Thread Chris Evans
Inline - Original Message - > From: "Ivan Calandra" > To: "R-help" > Sent: Wednesday, 19 August, 2020 16:56:32 > Subject: [R] combine filter() and select() > Dear useRs, > > I'm new to the tidyverse world and I need some help on basic thi

[R] combine filter() and select()

2020-08-19 Thread Ivan Calandra
Dear useRs, I'm new to the tidyverse world and I need some help on basic things. I have the following tibble: mytbl <- structure(list(files = c("a", "b", "c", "d", "e", "f"), prop = 1:6), row.names = c(NA, -6L), class = c("tbl_df", "tbl", "data.frame")) I want to subset the rows with "a" in the

Re: [R] Combine recursive lists in a single list or data frame and write it to file

2018-12-20 Thread Ek Esawi
Thanks again Jim. The links below are for 2 files (papers) i downloaded from Google Scholar for testing. You can use either both or any other pdf files with tables. Thanks again-EK. https://pdfs.semanticscholar.org/50a4/2b8146f08161b1036457fe0d241b6b898974.pdf https://pdfs.semanticscholar.org/50a4

Re: [R] Combine recursive lists in a single list or data frame and write it to file

2018-12-19 Thread Jim Lemon
Hi Ek, It looks to me as though you are not joining the lists into a single list, then calling FillList and then converting to a data frame. If you can send some data (if it's not too big) I can test it and make sure that it works, as it did every time for me. Jim On Thu, Dec 20, 2018 at 2:22 PM

Re: [R] Combine recursive lists in a single list or data frame and write it to file

2018-12-19 Thread Ek Esawi
Thank you Jim. I did use unlist with the recursive option which converted the 3 levels list to a list of 38 matrices. I tried your earlier function to join the 38 matrices, all of which have different number of columns and rows, but i kept getting an error. fillList<-function(x) { + maxrows<-m

Re: [R] Combine recursive lists in a single list or data frame and write it to file

2018-12-19 Thread Jim Lemon
Hi Ek, Look at unlist and the argument "recursive". You can step down through the levels or a nested list to convert it to a single level list. Jim On Thu, Dec 20, 2018 at 1:33 PM Ek Esawi wrote: > > Thank you Bert. I don't see how unlist will help. I want to combine > them but keep the "rectang

Re: [R] Combine recursive lists in a single list or data frame and write it to file

2018-12-19 Thread Ek Esawi
Thank you Bert. I don't see how unlist will help. I want to combine them but keep the "rectangular structure",e.g. list, data frame, matrix because i want to get the tables in their original form. Unlist converts the whole output to a single vector; unless i am missing something. On Wed, Dec 19,

Re: [R] Combine recursive lists in a single list or data frame and write it to file

2018-12-19 Thread Bert Gunter
Does ?unlist not help? Why not? Bert On Wed, Dec 19, 2018, 5:13 PM Ek Esawi Hi All— > > I am using the R tabulizer package to extract tables from pdf files. > The output is a set of lists of matrices. The package extracts tables > and a lot of extra stuff which is nearly impossible to clean wi

[R] Combine recursive lists in a single list or data frame and write it to file

2018-12-19 Thread Ek Esawi
Hi All— I am using the R tabulizer package to extract tables from pdf files. The output is a set of lists of matrices. The package extracts tables and a lot of extra stuff which is nearly impossible to clean with RegEx. So, I want to clean it manually. To do so I need to (1) combine all lists in

Re: [R] Combine lists into a data frame or append them to a text file

2018-12-16 Thread Ek Esawi
Hi Jim, Thanks again. Actually i changed my code where the lists are not nested. Your code works, as you said for the example, but still is not working for my lists (30). My lists have different columns and rows and several are NULL; plus there are many blank space which i suppose don't make much

Re: [R] Combine lists into a data frame or append them to a text file

2018-12-16 Thread Ek Esawi
I tried Jim's function and it works. But here is an example just in case. AA <- list(a=c(1,2,3,4),b = c("a","b","c")) BB <- list(c=c(1,2,3,4,5),d=c("a","b","c","d","e")) mylist <- (list(AA,BB)) lapply(mylist,function(x) write.table(x,file = test.txt)) Show Traceback Error in (function (..., ro

Re: [R] Combine lists into a data frame or append them to a text file

2018-12-15 Thread Jim Lemon
Hi Ek, I thought there would be a simple fix for this, but had to write a little function: fillList<-function(x) { maxrows<-max(unlist(lapply(x,length))) return(lapply(x,"[",1:maxrows)) } that fills up the rows of each list with NAs. I got the expected result with: testlist<-list(a=1:8,b=1:9,c

Re: [R] Combine lists into a data frame or append them to a text file

2018-12-15 Thread Bert Gunter
FWIW, I had no trouble writing a test case to a file with either version of your code. As we have no idea what your data look like, I don't know how anyone can diagnose the problem. But maybe I'm wrong and someone else will recognize the issue. Cheers, Bert Bert Gunter "The trouble with having a

[R] Combine lists into a data frame or append them to a text file

2018-12-15 Thread Ek Esawi
Hi All, I have an R object that is made up of N number of lists which are all of different number of columns and rows. I want to combine the N lists into a single data frame or write (append) them into text file. I hope the question is clear and doesn’t require an example. I am hoping to accompli

Re: [R] Combine by columns a vector with another vector that is constant across rows

2018-07-03 Thread Eric Berger
.davis.ca.us] > >Sent: Tuesday, 03 July, 2018 17:48 > >To: r-help@r-project.org; Viechtbauer, Wolfgang (SP); r-help@r- > >project.org > >Subject: Re: [R] Combine by columns a vector with another vector that is > >constant across rows > > > >Sorry trying ag

Re: [R] Combine by columns a vector with another vector that is constant across rows

2018-07-03 Thread Viechtbauer, Wolfgang (SP)
g >-Original Message- >From: Jeff Newmiller [mailto:jdnew...@dcn.davis.ca.us] >Sent: Tuesday, 03 July, 2018 17:48 >To: r-help@r-project.org; Viechtbauer, Wolfgang (SP); r-help@r- >project.org >Subject: Re: [R] Combine by columns a vector with another vector that is

Re: [R] Combine by columns a vector with another vector that is constant across rows

2018-07-03 Thread Jeff Newmiller
Sorry trying again... fastWolfgang <- function( v, vec ) { matrix( c( v, rep( vec, each = length( v ) ) ) , nrow = length( v ) ) } On July 3, 2018 8:21:47 AM PDT, Jeff Newmiller wrote: >Gabor's solution seems to optimize 'simpler'. > >More efficient is to learn that in R a vector is n

Re: [R] Combine by columns a vector with another vector that is constant across rows

2018-07-03 Thread Gabor Grothendieck
or this variation if you don't want the first column to be named init: Reduce(cbind2, vec, 1:5) On Tue, Jul 3, 2018 at 10:46 AM, Gabor Grothendieck wrote: > Try Reduce: > > Reduce(cbind, vec, 1:5) > > On Tue, Jul 3, 2018 at 9:28 AM, Viechtbauer, Wolfgang (SP) > wrote: >> Hi All, >> >> I have

Re: [R] Combine by columns a vector with another vector that is constant across rows

2018-07-03 Thread Jeff Newmiller
Gabor's solution seems to optimize 'simpler'. More efficient is to learn that in R a vector is not a matrix, but a matrix is just an ornamented vector. fastWolfgang <- function( v, vec ) { matrix( c( v, rep( vec, length( v ) ) ) , now = length( v ) ) } On July 3, 2018 6:28:45 AM PDT,

Re: [R] Combine by columns a vector with another vector that is constant across rows

2018-07-03 Thread Gabor Grothendieck
Try Reduce: Reduce(cbind, vec, 1:5) On Tue, Jul 3, 2018 at 9:28 AM, Viechtbauer, Wolfgang (SP) wrote: > Hi All, > > I have one vector that I want to combine with another vector and that other > vector should be the same for every row in the combined matrix. This > obviously does not work: >

Re: [R] Combine by columns a vector with another vector that is constant across rows

2018-07-03 Thread PIKAL Petr
Viechtbauer, > Wolfgang (SP) > Sent: Tuesday, July 3, 2018 3:29 PM > To: r-help@r-project.org > Subject: [R] Combine by columns a vector with another vector that is constant > across rows > > Hi All, > > I have one vector that I want to combine with another vector and

[R] Combine by columns a vector with another vector that is constant across rows

2018-07-03 Thread Viechtbauer, Wolfgang (SP)
Hi All, I have one vector that I want to combine with another vector and that other vector should be the same for every row in the combined matrix. This obviously does not work: vec <- c(2,4,3) cbind(1:5, vec) This does, but requires me to specify the correct value for 'n' in replicate(): cbi

Re: [R] Combine vectors under the names

2017-04-02 Thread Boris Steipe
Your code is syntactically correct but goes against all R style guides I know. I've changed that - but obviously you don't have to. x1 <- c(a1 = 0, b3 = 2, e2 = -2) x2 <- c(c = 3, d = 4, f = 5) N <- c("a1", "b3", "d", "e2", "c", "f") x3 <- c(x1, x2) # concatenate x3 <- x3[N

[R] Combine vectors under the names

2017-04-02 Thread Art U
Hello, Lets say I have 2 vectors: x1=c("a1"=0,"b3"=2,"e2"=-2); x2=c("c"=3,"d"=4,"f"=5); and vector of names in specific order: N=c("a1","b3","d","e2","c","f") and I want to combine them to vector C: C= a1 b3 d e2 c f 0 2 4 -2 3 5 Basically, just fill vector N with values from vector x1

Re: [R] combine

2017-03-26 Thread Bert Gunter
?merge with all.x and all.y both set to TRUE. Use the NA's **NOT** 0's for nonmatching values that merge() gives. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County"

Re: [R] combine

2017-03-25 Thread Boris Steipe
Initially: dat3 <- merge(dat1, dat2, all.x = TRUE, all.y = TRUE) ... and then you had asked for 0, not NA in your results. I think that's not a good idea - since you can't distinguish a legitimate value 0 from a missing value that way, but if you must: dat3[is.na(dat3)] <- 0 B. (and don't post

[R] combine

2017-03-25 Thread Ashta
Hi all, I have more than two files and merge by a single column and preserve the other columns. Here is an example of two files dat1 <- read.table(header=TRUE, text=' ID T1 T2 ID1125245 ID2141264 ID3133281') dat2 <- read.table(header=TRUE, text=' ID G1 G2 ID225 46

Re: [R] combine trellis lattice contour plot with simple plot() points() and text() commands?

2015-06-01 Thread Duncan Mackay
Behalf Of ivo welch Sent: Tuesday, 2 June 2015 07:03 To: r-help Subject: [R] combine trellis lattice contour plot with simple plot() points() and text() commands? can I add ordinary graphics commands to a contourplot? my naive attempts are telling me that plot.new() has not yet been called when I

Re: [R] combine trellis lattice contour plot with simple plot() points() and text() commands?

2015-06-01 Thread Jim Lemon
Hi Ivo, Not in a sane way. Have a look at the latticeExtra package that allows most of these things to be done. Jim On Tue, Jun 2, 2015 at 7:03 AM, ivo welch wrote: > can I add ordinary graphics commands to a contourplot? my naive > attempts are telling me that plot.new() has not yet been call

Re: [R] combine trellis lattice contour plot with simple plot() points() and text() commands?

2015-06-01 Thread David Winsemius
On Jun 1, 2015, at 2:03 PM, ivo welch wrote: > can I add ordinary graphics commands to a contourplot? my naive > attempts are telling me that plot.new() has not yet been called when I > try to add text(1,1,"hi") or points( c(0,1), c(1,0) )? There are lattice equivalents to many of the base prim

[R] combine trellis lattice contour plot with simple plot() points() and text() commands?

2015-06-01 Thread ivo welch
can I add ordinary graphics commands to a contourplot? my naive attempts are telling me that plot.new() has not yet been called when I try to add text(1,1,"hi") or points( c(0,1), c(1,0) )? [or do I need to rewrite another contourplot with the old graphics system. the basics are probably looking

Re: [R] Combine list element by column name to make a dataframe

2015-04-06 Thread Duncan Mackay
f New England Armidale NSW 2351 Email: home: mac...@northnet.com.au -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Mohammad Tanvir Ahamed via R-help Sent: Monday, 6 April 2015 16:06 To: r-help@r-project.org Subject: [R] Combine list element by column name to m

Re: [R] Combine list element by column name to make a dataframe

2015-04-06 Thread Michael Hannon
Maybe something like the appended? -- Mike lst <- list(setNames(c(1,10,50,60,70,80), c("id","id1","math","phy","che","bio")), setNames(c(2,20,45), c("id","id1","phy")), setNames(c(3,30,75), c("id","id1","bio"))

Re: [R] Combine list element by column name to make a dataframe

2015-04-06 Thread peter dalgaard
> On 06 Apr 2015, at 08:05 , Mohammad Tanvir Ahamed via R-help > wrote: > > Hi ,� > > I have a example list like follow� > > > > > lst<-list(setNames(c(1,10,50,60,70,80),c("id","id1","math","phy","che","bio")),setNames(c(2,20,45),c("id","id1","ph

[R] Combine list element by column name to make a dataframe

2015-04-06 Thread Mohammad Tanvir Ahamed via R-help
Hi ,� I have a example list like follow� lst<-list(setNames(c(1,10,50,60,70,80),c("id","id1","math","phy","che","bio")),setNames(c(2,20,45),c("id","id1","phy")),setNames(c(3,30,75),c("id","id1","bio"))) My expected outcome :� -

Re: [R] Combine factorial column intp a new column

2014-05-22 Thread arun
Hi, May be this helps:  ddNew <-  transform(dd_1, CLASS= gsub("NA-|-NA","",paste(Class_a, Class_b, sep="-")))  identical(ddNew, dd_2) #[1] TRUE A.K. On Thursday, May 22, 2014 4:07 AM, Beatriz R. Gonzalez Dominguez wrote: Dear R-users, I'd be very greatful if you could help me with the follo

[R] Combine factorial column intp a new column

2014-05-22 Thread Beatriz R. Gonzalez Dominguez
Dear R-users, I'd be very greatful if you could help me with the following as after a few tests I haven't still been able to get the right outcome. I've got this data: dd_1 <- data.frame(ID = c("1","2", "3", "4", "5"), Class_a = c("a",NA, "a", NA, NA), Class_b

Re: [R] combine 2 data.frames in dependence of the ID

2014-02-26 Thread arun
to:smartpink...@yahoo.com] Gesendet: Mittwoch, 26. Februar 2014 10:08 An: Matthias Weber Betreff: Re: [R] combine 2 data.frames in dependence of the ID #or you could do: dcast(ddply(merge(dat1,dat2,by="FS_ID")[,-1],.(ABNR), mutate, DATE=cut(seq_along(DATE),breaks=c(0,1,2,3,4,5,

Re: [R] combine 2 data.frames in dependence of the ID

2014-02-26 Thread arun
run [mailto:smartpink...@yahoo.com] Gesendet: Mittwoch, 26. Februar 2014 10:08 An: Matthias Weber Betreff: Re: [R] combine 2 data.frames in dependence of the ID #or you could do: dcast(ddply(merge(dat1,dat2,by="FS_ID")[,-1],.(ABNR), mutate, DATE=cut(seq_along(DATE),breaks=c(0,1,2,3,4,5,

Re: [R] combine 2 data.frames in dependence of the ID

2014-02-26 Thread Mat
thanks for the help up to here. A little problem remains. I have different "ABNR", if i try it with another ABNR, the Column extend for each ABNR, it should start with "FIRST" again. dat1 <- read.table(text="FS_ID ABNR 932733688812 11391 33688812 11392 33688812 11388 33688812 11390 3368

Re: [R] combine 2 data.frames in dependence of the ID

2014-02-25 Thread arun
Hi, May be this helps: dat1 <- read.table(text="FS_ID  ABNR 9327    33688812 11391  33688812 11392  33688812 11388  33688812 11390  33688812 12028  33688812 12029  33688812",sep="",header=TRUE) dat2 <- read.table(text="FS_ID  DATE  POST 11390  2012-12-13    28 12029  2013-01-17    28.3

[R] combine 2 data.frames in dependence of the ID

2014-02-25 Thread Mat
Hello together, i have a little problem, maybe anyone can help me. I have 2 data.frame, one look like this one: FS_ID ABNR 9327 33688812 11391 33688812 11392 33688812 11388 33688812 11390 33688812 12028 33688812 12029 33688812 the other data.frame looks like as follows: FS_ID

Re: [R] combine glmnet and coxph (and survfit) with strata()

2013-12-09 Thread Jieyue Li
check this one http://stackoverflow.com/questions/16299891/estimating-many-interaction-terms-in-glmnet On Mon, Dec 9, 2013 at 5:39 AM, Aaron Mackey wrote: > I'm also curious how to use glmnet with survfit -- specifically, for use > with interval regression (which, under the hood, is implemented

Re: [R] combine glmnet and coxph (and survfit) with strata()

2013-12-09 Thread Aaron Mackey
I'm also curious how to use glmnet with survfit -- specifically, for use with interval regression (which, under the hood, is implemented using survfit). Can you show how you converted your Surv object formula to a design matrix for use with glmnet? Thanks, -Aaron On Sun, Dec 8, 2013 at 12:45 AM

[R] combine glmnet and coxph (and survfit) with strata()

2013-12-07 Thread Jieyue Li
Dear All, I want to generate survival curve with cox model but I want to estimate the coefficients using glmnet. However, I also want to include a strata() term in the model. Could anyone please tell me how to have this strata() effect in the model in glmnet? I tried converting a formula with stra

Re: [R] Combine columns having same column name from multiple data frames

2013-11-23 Thread arun
Hi, You may try: lapply(seq_len(ncol(data1)),function(i) {x1 <- do.call(cbind,lapply(lapply(as.list(paste0("data",1:3)),get),`[`,i)); write.csv(x1,paste0("new",i,".csv"),quote=FALSE) }) A.K. Dear All, I am trying to combine columns having same name from 3 different data frames and create ne

Re: [R] combine all data frame columns into a vector.

2013-08-12 Thread Khan, Sohail
Thanks Arun and Bert. Both options work. -Sohail -Original Message- From: arun [mailto:smartpink...@yahoo.com] Sent: Monday, August 12, 2013 4:51 PM To: Khan, Sohail Cc: R help Subject: Re: [R] combine all data frame columns into a vector. Hi, May be this help: dat1<- structure(l

Re: [R] combine all data frame columns into a vector.

2013-08-12 Thread arun
", "f", "a", "z", "q", "i", "o", "v", "a", "s"),     V9 = c("n", "d", "n", "f", "j", "j", "g", "w", "k", "v&quo

Re: [R] combine all data frame columns into a vector.

2013-08-12 Thread Khan, Sohail
Thanks Bert, All are character values. -Sohail -Original Message- From: Bert Gunter [mailto:gunter.ber...@gene.com] Sent: Monday, August 12, 2013 4:35 PM To: Khan, Sohail Cc: greatest.possible.newbie; r-help@r-project.org Subject: Re: [R] combine all data frame columns into a vector

Re: [R] combine all data frame columns into a vector.

2013-08-12 Thread Bert Gunter
Sohail: 1. Are they character or factor? 2. ?unlist > unique(unlist(yourframe)) -- Bert On Mon, Aug 12, 2013 at 1:23 PM, Khan, Sohail wrote: > Dear All, > > Could anyone suggest a quick way to combine all columns in a data frame into > a vector? > For example, I have a data frame of 205 colum

[R] combine all data frame columns into a vector.

2013-08-12 Thread Khan, Sohail
Dear All, Could anyone suggest a quick way to combine all columns in a data frame into a vector? For example, I have a data frame of 205 columns with character data types, many data values are repeated in all the columns. Actually, I would like to retrieve all the unique values from this data

Re: [R] Combine multiple random forests contained in a list

2013-07-26 Thread Bert Gunter
I would say that the use of Reduce in this context is bad practice. from ?Reduce : "Reduce uses a binary function to successively combine the elements of a given vector and a possibly given initial value." combine() is obviously not a binary function. do.call() seems to be THE appropriate idiom.

Re: [R] Combine multiple random forests contained in a list

2013-07-26 Thread arun
HI, Using the example in ?combine library(randomForest) rf1 <- randomForest(Species ~ ., iris, ntree=50, norm.votes=FALSE)   rf2 <- randomForest(Species ~ ., iris, ntree=50, norm.votes=FALSE)   rf3 <- randomForest(Species ~ ., iris, ntree=50, norm.votes=FALSE)   rf.all <- combine(rf1, r

Re: [R] combine select data from 2 dataframes sharing same variables

2013-07-18 Thread bcrombie
Wow. That is exactly what I wanted (thread viewers see output below). I think/hope this script will be more user friendly for my needs (RTF final output) than the loop I currently have for LaTex output. Thanks very much A.K. I’ll need to send you a Bundt cake at some point I suppose… BN

Re: [R] combine select data from 2 dataframes sharing same variables

2013-07-18 Thread bcrombie
Hi, Peter. Thanks for the suggestion. I will investigate ?merge. BNC From: Peter Alspach-2 [via R] [mailto:ml-node+s789695n4671809...@n4.nabble.com] Sent: Wednesday, July 17, 2013 8:08 PM To: Crombie, Burnette N Subject: Re: combine select data from 2 dataframes sharing same variables Tena koe

Re: [R] combine select data from 2 dataframes sharing same variables

2013-07-17 Thread arun
t;);x1})  names(lst1)<- colnames(StatsUTAH) A.K. - Original Message - From: bcrombie To: r-help@r-project.org Cc: Sent: Wednesday, July 17, 2013 4:12 PM Subject: [R] combine select data from 2 dataframes sharing same variables #  The following dataframes are the result of two

Re: [R] combine select data from 2 dataframes sharing same variables

2013-07-17 Thread Peter Alspach
: Thursday, 18 July 2013 8:13 a.m. To: r-help@r-project.org Subject: [R] combine select data from 2 dataframes sharing same variables # The following dataframes are the result of two analyses performed on the same set of numeric data. # The first analysis involved calculations that did not in

[R] combine select data from 2 dataframes sharing same variables

2013-07-17 Thread bcrombie
# The following dataframes are the result of two analyses performed on the same set of numeric data. # The first analysis involved calculations that did not include zero values: StatsUTAH = data.frame(MWtotaleesDue = c(8.428571,2.496256,7,6.604472,1,17,3.593998,4.834573,12.02257),

[R] combine attributes

2013-06-27 Thread Nico Bl
hello, i have to do a sna for a seminar. i have a csv.data with acteurs. i can identify a cooperation between acteurs with an ID in the csc.data. Is the ID equal with another acteur, so they have an cooperation. furthermore i have an information about the acteurs in the csv.data. there are thre

Re: [R] combine two columns into one

2013-05-29 Thread arun
paste(Date,Time,sep="_"))[,c(4,3)]  res #    DT Var #1 2012-11-01_1   5 #2 2012-11-01_2   5 #3 2012-11-02_1   5 #4 2012-11-02_2   3 A.K. From: Ye Lin To: arun Cc: R help Sent: Wednesday, May 29, 2013 2:40 PM Subject: Re: [R] combine two columns in

Re: [R] combine two columns into one

2013-05-29 Thread Ye Lin
; # UniqueID Var > #1 1_1 11 > #2 1_2 25 > #3 2_1 11 > A.K. > > > > - Original Message - > From: Ye Lin > To: R help > Cc: > Sent: Wednesday, May 29, 2013 2:23 PM > Subject: [R] combine two columns into one > > Hey all! &g

Re: [R] combine two columns into one

2013-05-29 Thread arun
(Var)) #  UniqueID Var #1  1_1  11 #2  1_2  25 #3  2_1  11 A.K. - Original Message - From: Ye Lin To: R help Cc: Sent: Wednesday, May 29, 2013 2:23 PM Subject: [R] combine two columns into one Hey all! I have a time series dataset like this: Date    Time  Var 1     

[R] combine two columns into one

2013-05-29 Thread Ye Lin
Hey all! I have a time series dataset like this: DateTime Var 112 1 14 1 1 5 1 2 8 1 2 8 1 2 9 213 21 4 214 I created a

Re: [R] Combine multiple tables into one

2013-05-01 Thread arun
: Wednesday, May 1, 2013 10:47 PM Subject: Re: [R] Combine multiple tables into one Isn't this just a block diagonal matrix? library(pracma) blkdiag(table1, table2)     [,1] [,2] [,3] [,4] [1,]    1    1    0    0 [2,]    1    2    0    0 [3,]    0    0    0    1 [4,]    0    0    0    4 D

Re: [R] Combine multiple tables into one

2013-05-01 Thread Dennis Murphy
Isn't this just a block diagonal matrix? library(pracma) blkdiag(table1, table2) [,1] [,2] [,3] [,4] [1,]1100 [2,]1200 [3,]0001 [4,]0004 Dennis On Wed, May 1, 2013 at 5:41 PM, David Winsemius wrote: > add2blocks <- function(m

Re: [R] Combine multiple tables into one

2013-05-01 Thread David Winsemius
add2blocks <- function(m1, m2) { res <- cbind(m1, matrix(0, dim(m2)[1], dim(m2)[2]) ) res <- rbind(res, cbind( matrix(0, dim(m1)[1], dim(m1)[2]), m2) ) } new <- add2block(table1, table2) new #--- [,1] [,2] [,3] [,4] row11100 row212

Re: [R] Combine multiple tables into one

2013-05-01 Thread arun
Hi, May be this helps: dat1<- as.data.frame(table1)  dat2<- as.data.frame(table2) names(dat2)<-c("V3","V4") library(plyr) res<-join(dat1,dat2,type="full")  res[is.na(res)]<- 0  res #  V1 V2 V3 V4 #1  1  1  0  0 #2  1  2  0  0 #3  0  0  0  1 #4  0  0  0  4  combinedtable<-as.matrix(res)  colnames(

Re: [R] combine similar variables in chart

2012-11-15 Thread Jean V Adams
You've included three "I want"s in your message, but no question. Are you looking for functions? Try searching ... in R, on google, on http://rseek.org/, ... Have you tried some code, but can't get it to work? Send your code with error messages, and tell us precisely what you trying to get yo

[R] combine similar variables in chart

2012-11-15 Thread Marcella
I want to make a chart on variables which are taken in 2 different years on 2 the same locations, at different depths, where for every location the species and the amount of species are determined. The first chart I want to make is to see how much of every species is collected in total in a bar or

Re: [R] combine unadjusted and adjusted forest plots

2012-10-18 Thread Viechtbauer Wolfgang (STAT)
JV1) 6200 MD Maastricht, The Netherlands +31 (43) 388-4170 | http://www.wvbauer.com > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of Romita Mukerjee, M.D. > Sent: Wednesday, October 10, 2012 21:43 > To: r-he

[R] combine unadjusted and adjusted forest plots

2012-10-10 Thread Romita Mukerjee, M.D.
Hello, I am learning to use the metafor package to conduct meta-regression analyses for a systematic review on multidisciplinary care interventions in chronic kidney disease. For the forest plots, I can't figure out how to plot unadjusted and adjusted models on the same plot. From top to bott

Re: [R] Combine two variables

2012-09-11 Thread arun
Original Message - From: Simon Kiss To: r-help@r-project.org Cc: Sent: Tuesday, September 11, 2012 10:57 AM Subject: [R] Combine two variables Hi: I have two variables in a data frame that are the results of a wording experiment in a survey. I'd like to create a third variable that

Re: [R] Combine two variables

2012-09-11 Thread PIKAL Petr
p@r-project.org > Subject: [R] Combine two variables > > Hi: > I have two variables in a data frame that are the results of a wording > experiment in a survey. I'd like to create a third variable that > combines the two variables. Recode doesn't seem to work, because it &

Re: [R] Combine two variables

2012-09-11 Thread Rui Barradas
Hello, Inline. Em 11-09-2012 15:57, Simon Kiss escreveu: Hi: I have two variables in a data frame that are the results of a wording experiment in a survey. I'd like to create a third variable that combines the two variables. Recode doesn't seem to work, because it just recodes the first var

[R] Combine two variables

2012-09-11 Thread Simon Kiss
Hi: I have two variables in a data frame that are the results of a wording experiment in a survey. I'd like to create a third variable that combines the two variables. Recode doesn't seem to work, because it just recodes the first variable into the third, then recodes the second variable into t

Re: [R] Combine subsets by factor level

2012-06-06 Thread arun
  7 0.73625734 0.7494620   NA 0.05603698   NA 8    8 0.87371378 1.2154369   NA 0.87648443   NA 9    9 1.28035157 0.9905966   NA 1.01691054   NA 10  10 1.02381366 0.6490431   NA 2.28296855   NA A.K. From: Lib Gray To: arun

Re: [R] Combine subsets by factor level

2012-06-06 Thread Lib Gray
NA 0.3861208 1.1349206 > 99 1.5659958 1.8725942 1.5676570 > 10 10 1.0895054 1.1941775 1.3932515 > > > For the missing values, I assume that cycle will be in the dataset on the > longformat and its value as NA. > > > A.K. > > > ___

Re: [R] Combine subsets by factor level

2012-06-06 Thread arun
___ From: Lib Gray To: arun Cc: R help Sent: Wednesday, June 6, 2012 2:28 PM Subject: Re: [R] Combine subsets by factor level Yes, except that patients have different cycle numbers. Such as, one might have cycle 1,2,3, and another has 1,4,12. On Jun 6, 2012 12:54 PM, "arun" wr

Re: [R] Combine subsets by factor level

2012-06-06 Thread Lib Gray
10 cycle2 1.3932515 > > > > > > A.K. > > > > > > > - Original Message - > From: lglucia > To: r-help@r-project.org > Cc: > Sent: Wednesday, June 6, 2012 12:07 AM > Subject: [R] Combine subsets by factor level > > I'm attem

Re: [R] Combine subsets by factor level

2012-06-06 Thread arun
al Message - From: lglucia To: r-help@r-project.org Cc: Sent: Wednesday, June 6, 2012 12:07 AM Subject: [R] Combine subsets by factor level I'm attempting to change a data set by compressing rows into columns. Currently there are several rows that all have information about one "p

Re: [R] Combine subsets by factor level

2012-06-06 Thread John Kane
ue, 5 Jun 2012 21:07:50 -0700 (PDT) > To: r-help@r-project.org > Subject: [R] Combine subsets by factor level > > I'm attempting to change a data set by compressing rows into columns. > Currently there are several rows that all have information about one > "patient," b

[R] Combine subsets by factor level

2012-06-05 Thread lglucia
I'm attempting to change a data set by compressing rows into columns. Currently there are several rows that all have information about one "patient," but at different cycles. I'm trying to make each patient only have one row in the data set. Does anyone know a good way to combine data sets by fact

Re: [R] Combine two tables by row with different columns

2012-05-09 Thread Rui Barradas
Hello, Try this T1 <- read.table(text=" X Y Z XX A 1 5 9 13 B 2 6 10 14 C 3 7 11 15 D 4 8 12 16 ", header=TRUE) T2 <- read.table(text=" X Y XX a 1 4 7 b 2 5 8 c 3 6 9 ", header=TRUE) cT <- read.table(text=" X Y XX A 1 5 13 B 2 6 14 C 3 7 15 D 4 8 16 A1 1 4 7 B1 2 5 8 C1 3 6

Re: [R] Combine two tables by row with different columns

2012-05-09 Thread R. Michael Weylandt
T2 >   X Y XX > A1 1 4  7 > B1 2 5  8 > C1 3 6  9 >> T1T2<-cbind(T1,T2) > Error in cbind(T1, T2) : >  number of rows of matrices must match (see arg 2) > > I want to have the following table (probably you noticed that column Z in > Table 1 is not in Table 2)

Re: [R] Combine two tables by row with different columns

2012-05-09 Thread Kristi Glover
d(T1,T2) Error in cbind(T1, T2) : number of rows of matrices must match (see arg 2) I want to have the following table (probably you noticed that column Z in Table 1 is not in Table 2) X Y XX A 1 5 13 B 2 6 14 C 3 7 15 D 4 8 16 A1 1 4 7 B1 2 5 8 C1 3 6 9 any suggestions? this is just an ex

Re: [R] Combine two tables by row with different columns

2012-05-09 Thread David Winsemius
On May 9, 2012, at 9:21 PM, Kristi Glover wrote: Hi R user, I could not combine two tables. Would any one help me on how I can combine with following example tables? You do realize that tables in R are not dataframes. They are a type of matrix. T1 X Y Z XX A 1 5 9 13 B 2 6 10 14

[R] Combine two tables by row with different columns

2012-05-09 Thread Kristi Glover
Hi R user, I could not combine two tables. Would any one help me on how I can combine with following example tables? > T1 X Y Z XX A 1 5 9 13 B 2 6 10 14 C 3 7 11 15 D 4 8 12 16 > T2 X Y XX a 1 4 7 b 2 5 8 c 3 6 9 I want to get the following table cT X Y XX A 1 5 13 B 2 6 14

Re: [R] Combine variables of different length

2011-11-01 Thread R. Michael Weylandt
Perhaps something like this: X = jitter(1:10) Y = jitter(3*X-5, factor = 3) X[3] = NA m = lm(Y~X)$fitted.values fits <- rep(NA, length(X)); fits[as.numeric(names(m))] <- m; cbind(X,Y,fits) Michael On Tue, Nov 1, 2011 at 8:52 AM, Johannes Radinger wrote: > Hi, > > I have got a dataset with > t

[R] Combine variables of different length

2011-11-01 Thread Johannes Radinger
Hi, I have got a dataset with the variables Y,X1,X2,X3. Some of these variables contain NAs. Therefore incomplete datasets aren't recognized when I am doing a regression like: model <- lm(Y~X1+X2+X3) so the resulting vector of resid(model) is obviousely shorter then the original variables. How

Re: [R] combine the data frames into comma separated list.

2011-06-13 Thread Mary Kindall
Superb Gabor, Though I dont know what is happening, but yes it is workin and without fail. Thanks - M On Mon, Jun 13, 2011 at 8:20 PM, Gabor Grothendieck wrote: > On Mon, Jun 13, 2011 at 5:17 PM, Mary Kindall > wrote: > > Hi R users, > > I am new to R and am trying to merge data frames in the

  1   2   >