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
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
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
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
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
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
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
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-
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
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
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
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
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
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
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
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
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,
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
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
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
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
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
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
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
.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
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
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
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
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,
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:
>
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
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
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
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
?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"
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
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
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
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
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
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
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
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"))
> 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
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 :�
-
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
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
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,
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,
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
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
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
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
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
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
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
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
", "f", "a", "z", "q", "i", "o", "v", "a", "s"),
V9 = c("n", "d", "n", "f", "j", "j", "g", "w", "k", "v&quo
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
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
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
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.
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
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
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
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
: 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
# 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),
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
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
; # 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
(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
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
: 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
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
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
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(
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
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
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
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
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
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
&
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
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
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
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.
>
>
> ___
___
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
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
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
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
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
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
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)
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
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
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
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
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
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 - 100 of 184 matches
Mail list logo