Hi Kai,
How about setting:
germlinepatients$DisclosureStatus <- NA
then having your three conditional statements as indices:
germlinepatients$DisclosureStatus[germlinepatients$gl_resultsdisclosed
== 1] <-"DISCLOSED"
germlinepatients$DisclosureStatus[germlinepatients$
gl_resultsdisclosed == 0]
Hello List,
I wrote the script below to assign value to a new field DisclosureStatus.
my goal is if gl_resultsdisclosed=1 then DisclosureStatus=DISCLOSED
else if gl_resultsdisclosed=0 then DisclosureStatus= ATTEMPTED
else if gl_resultsdisclosed is missing and gl_discloseattempt1 is not missing
"data.frame", row.names = c(NA, -396L
))
Regards
Duncan
-Original Message-
From: David Winsemius [mailto:dwinsem...@comcast.net]
Sent: Monday, 19 December 2016 13:47
To: Duncan Mackay
Cc: R
Subject: Re: [R] data manipulation
> On Dec 18, 2016, at 5:39 PM, Duncan Mackay <
an
>>> Duncan Mackay
>>> Department of Agronomy and Soil Science
>>> University of New England
>>> Armidale NSW 2351
>>> Email: home: mac...@northnet.com.au
>>>
>>> -Original Message-
>>> From: R-help [mailto:r-help-boun
Original Message-
> From: David Winsemius [mailto:dwinsem...@comcast.net]
> Sent: Monday, 19 December 2016 05:36
> To: Duncan Mackay
> Cc: R
> Subject: Re: [R] data manipulation
>
>
>> On Dec 17, 2016, at 7:57 PM, Duncan Mackay <dulca...@bigpond.com> wrote:
>
Hi David
Thanks for the info.
As a test I am attaching it anyway
Regards
Duncan
-Original Message-
From: David Winsemius [mailto:dwinsem...@comcast.net]
Sent: Monday, 19 December 2016 05:36
To: Duncan Mackay
Cc: R
Subject: Re: [R] data manipulation
> On Dec 17, 2016, at 7:57
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 Rui Barradas
>> Sent: Thursday, 15 December 2016 01:19
>> To: Farshad Fathian; r-help
> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Rui Barradas
> Sent: Thursday, 15 December 2016 01:19
> To: Farshad Fathian; r-help
> Subject: Re: [R] data manipulation
>
> Hello,
>
> Please cc your mails to the list.
ect.org] On Behalf Of Rui Barradas
> Sent: Thursday, 15 December 2016 01:19
> To: Farshad Fathian; r-help
> Subject: Re: [R] data manipulation
>
> Hello,
>
> Please cc your mails to the list.
> As for your data, your url is wrong, you need to contact Massey or maybe
> the
of Agronomy and Soil Science
University of 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 Rui Barradas
Sent: Thursday, 15 December 2016 01:19
To: Farshad Fathian; r-help
Subject: Re: [R] data
That should read "now" instead of "not"
On Thursday, December 15, 2016 6:49 PM, John Kane
wrote:
It downloaded a file for me earlier but I am not getting the 404 error and I
did not bother to save the download. Shrug.
On Wednesday, December 14, 2016 6:57
It downloaded a file for me earlier but I am not getting the 404 error and I
did not bother to save the download. Shrug.
On Wednesday, December 14, 2016 6:57 AM, John Kane via R-help
wrote:
xx <- read.csv("http://massey.ac.nz/~pscoperwait/ts/cbe.dat;)
gives me
On Behalf Of Rui Barradas
Sent: Wednesday, December 14, 2016 6:12 AM
To: John Kane; Farshad Fathian; r-h...@stat.math.ethz.ch
Subject: Re: [R] data manipulation
Hello,
What do you mean by "gives me something"?
xx <- read.csv("http://massey.ac.nz/~pscoperwait/ts/cbe.dat;)
Erro
ge Station, TX 77840-4352
>
>
>
> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Rui Barradas
> Sent: Wednesday, December 14, 2016 6:12 AM
> To: John Kane; Farshad Fathian; r-h...@stat.math.ethz.ch
> Subject: Re: [R] data manipulati
...@stat.math.ethz.ch
Subject: Re: [R] data manipulation
Hello,
What do you mean by "gives me something"?
xx <- read.csv("http://massey.ac.nz/~pscoperwait/ts/cbe.dat;)
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
Hello,
Please cc your mails to the list.
As for your data, your url is wrong, you need to contact Massey or maybe
the source of your information and get a valid internet address.
Without one there's not much we can do.
Rui Barradas
Em 14-12-2016 12:16, Farshad Fathian escreveu:
Hello,
Hello,
What do you mean by "gives me something"?
xx <- read.csv("http://massey.ac.nz/~pscoperwait/ts/cbe.dat;)
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
cannot open URL 'http://massey.ac.nz/~pscoperwait/ts/cbe.dat': HTTP
status
xx <- read.csv("http://massey.ac.nz/~pscoperwait/ts/cbe.dat;)
gives me something. Since we have no idea of what you are doing I don't know if
the data has downloaded correctly
On Tuesday, December 13, 2016 1:38 PM, Farshad Fathian
wrote:
Hi,
I couldn't
On Tue, Dec 13, 2016 at 3:23 AM, Farshad Fathian
wrote:
> Hi,
>
> I couldn't access to data file about PSCoperwait by
> http://massey.ac.nz/~pscoperwait/ts/cbe.dat.
>
First off, this post is nearly useless. You don't tell us what you tried
to do. And you didn't tell
Hello,
And what has your question to do with R?
Please read the posting guide before posting and when you do, post a
question where at least the link is correct.
Rui Barradas
Em 13-12-2016 09:23, Farshad Fathian escreveu:
Hi,
I couldn't access to data file about PSCoperwait by
Hi,
I couldn't access to data file about PSCoperwait by
http://massey.ac.nz/~pscoperwait/ts/cbe.dat.
Looking forward to hearing from you,
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and
))
Thanks in advance,
IOanna
-Original Message-
From: arun [mailto:smartpink...@yahoo.com]
Sent: 21 February 2014 00:19
To: r-help@r-project.org
Cc: ioanna ioannou
Subject: Re: [R] Data manipulation in a data.frame
Also,
rownames(which(t(!!A[,-1]),arr.ind=TRUE))
A.K.
On Thursday, February 20
To: r-help@r-project.org
Cc: ioanna ioannou
Subject: Re: [R] Data manipulation in a data.frame
Also,
rownames(which(t(!!A[,-1]),arr.ind=TRUE))
A.K.
On Thursday, February 20, 2014 6:48 PM, arun smartpink...@yahoo.com wrote:
Hi,
May be this helps:
A$Variable - rep(colnames(A[,-1]),nrow
...@yahoo.com]
Sent: 21 February 2014 00:19
To: r-help@r-project.org
Cc: ioanna ioannou
Subject: Re: [R] Data manipulation in a data.frame
Also,
rownames(which(t(!!A[,-1]),arr.ind=TRUE))
A.K.
On Thursday, February 20, 2014 6:48 PM, arun smartpink...@yahoo.com wrote:
Hi,
May be this helps
,C,D,none))
Thanks in advance,
IOanna
-Original Message-
From: arun [mailto:smartpink...@yahoo.com]
Sent: 21 February 2014 00:19
To: r-help@r-project.org
Cc: ioanna ioannou
Subject: Re: [R] Data manipulation in a data.frame
Also,
rownames(which(t(!!A[,-1]),arr.ind=TRUE))
A.K
Hi Ioanna,
If you need to paste the colnames if there are multiple 1's per row:
You could try:
A-data.frame(A=c(10,100,1000,30,50,60,300,3,4,2,20,35,45),B=c(0,1,1,1,0,0,0,0,0,1,0,0,1),C=c(0,0,0,0,1,1,0,0,0,0,1,1,1),D=c(1,0,0,0,0,0,1,0,0,1,NA,1,1))
apply(A[,-1],1,function(x) {x1
Hello,
Assuming that I have a data frame
A-data.frame(A=c(10,100,1000,30,50,60,300),
B=c(0,1,1,1,0,0,0),
C=c(0,0,0,0,1,1,0),
D=c(1,0,0,0,0,0,1))
What I would like is to introduce a new column Variable such that:
Hi,
May be this helps:
A$Variable - rep(colnames(A[,-1]),nrow(A))[t(!!A[,-1])]
A.K.
On Thursday, February 20, 2014 5:55 PM, ioanna ioannou ii54...@msn.com wrote:
Hello,
Assuming that I have a data frame
A-data.frame(A=c(10,100,1000,30,50,60,300),
B=c(0,1,1,1,0,0,0),
Also,
rownames(which(t(!!A[,-1]),arr.ind=TRUE))
A.K.
On Thursday, February 20, 2014 6:48 PM, arun smartpink...@yahoo.com wrote:
Hi,
May be this helps:
A$Variable - rep(colnames(A[,-1]),nrow(A))[t(!!A[,-1])]
A.K.
On Thursday, February 20, 2014 5:55 PM, ioanna ioannou ii54...@msn.com wrote:
... and yet another approach (written for generalization)
names(A)[-1][as.matrix(A[,-1])%*%(seq_len(ncol(A)-1))]
[1] D B B B C C D
Cheers,
Bert
Bert Gunter
Genentech Nonclinical Biostatistics
(650) 467-7374
Data is not information. Information is not knowledge. And knowledge
is certainly
Hi everyone.
I have a list like this:
neutral_classes = list(A = 71:100, B = 46:70, C = 21:45, D = 0:20)
and I'm trying to return the letter of the named vector for with an integer
belong. For example, B if I use the value 50.
Any help would be greatly appreciated.
Regards,Phil
I think a list is the wrong structure,
a vector would be better since you can
use 'match':
# transform data structure:
neutralVec - unlist(neutral_classes)
names(neutralVec) -
names(neutral_classes[rep(1:length(neutral_classes),
sapply(neutral_classes, length))]
# get one or more results
Hi,
You could use either:
names(which(sapply(lapply(neutral_classes,`%in%`,50),any)))
#[1] B
#or
vec1 -unlist(neutral_classes)
names(vec1) - gsub(\\d+,,names(vec1))
names(vec1)[vec1==50]
#[1] B
A.K.
Hi everyone.
I have a list like this:
neutral_classes = list(A = 71:100, B = 46:70, C =
The final ) went missing in the command
starting 'names(neutralVec) - '.
On 22/11/2013 17:51, Patrick Burns wrote:
I think a list is the wrong structure,
a vector would be better since you can
use 'match':
# transform data structure:
neutralVec - unlist(neutral_classes)
names(neutralVec) -
Thank you everyone for your suggestions.
Date: Fri, 22 Nov 2013 18:04:16 +
From: pbu...@pburns.seanet.com
To: pmassico...@hotmail.com; r-help@r-project.org
Subject: Re: [R] data manipulation
The final ) went missing in the command
starting 'names(neutralVec) - '.
On 22/11/2013 17
...@hotmail.com
To: r-help@r-project.org
Date: Fri, 22 Nov 2013 18:17:03 +
Subject: Re: [R] data manipulation
Thank you everyone for your suggestions.
Date: Fri, 22 Nov 2013 18:04:16 +
From: pbu...@pburns.seanet.com
To: pmassico...@hotmail.com; r-help@r-project.org
Subject: Re
-boun...@r-project.org
[mailto:r-help-boun...@r-project.org] On Behalf Of philippe
massicotte
Sent: Friday, November 22, 2013 12:27 PM
To: r-help@r-project.org
Subject: Re: [R] data manipulation
Hi again.
I realized that the example I give is not valid, because the
number I'm using is not an integer
Hi Arun:
Thanks for your help. Seperate files are being created by concatenating the
rows from the two files but I was looking to have them as columns rather
than text. This is the way it appears in Excel with row # at the beginning.
X Y1 Y2
1 1 4 0 20 17 1 20 52 15 18
Ideally I would like it to
Hi,
I am getting this.
res - lapply(seq_len(nrow(Y1)),function(i) {dat -
data.frame(X=i,Y1=unlist(Y1[i,]),Y2=unlist(Y2[i,])); row.names(dat) -
1:nrow(dat);
write.csv(dat,paste0(Anam,i,.csv),row.names=FALSE,quote=FALSE)})
dat1 - read.csv(Anam1.csv,header=TRUE)
dat1
X Y1 Y2
1 1 4 20
2
Hi:
I am looking for some help to manipulate data in R. I have two csv files.
datasetY1
V1 V2 V3 V4
1 4 0 20 17
2 4 0 15 17
3 2 0 13 21
datasetY2
V1 V2 V3 V4
1 20 52 15 18
2 18 54 14 21
3 18 51 13 21
I want to be able to create separate csv files by taking the corresponding
rows of
Hi,
May be this helps:
Y1 - read.table(text=V1 V2 V3 V4
1 4 0 20 17
2 4 0 15 17
3 2 0 13 21,sep=,header=TRUE)
Y2 - read.table(text=V1 V2 V3 V4
1 20 52 15 18
2 18 54 14 21
3 18 51 13 21,sep=,header=TRUE)
res - lapply(seq_len(nrow(Y1)),function(i) {dat -
Hello all!
I have a problem with my data.
My initial data is a list years and months (see below). I want to transpose
my data (12 rows (months) and year values as column). I try t(spi3), but
the year values do not appear as column names, but as values. Please help
me to solve this problem!
Thank
On 15-05-2013, at 08:15, catalin roibu catalinro...@gmail.com wrote:
Hello all!
I have a problem with my data.
My initial data is a list years and months (see below). I want to transpose
my data (12 rows (months) and year values as column). I try t(spi3), but
the year values do not appear
On 05/15/2013 04:15 PM, catalin roibu wrote:
Hello all!
I have a problem with my data.
My initial data is a list years and months (see below). I want to transpose
my data (12 rows (months) and year values as column). I try t(spi3), but
the year values do not appear as column names, but as
Hello all,
I would appreciate your thoughts on a seemingly simple problem. I have a
database, where each row represent a single record. I want to aggregate this
database so I use the aggregate command :
D-read.csv(C:\\Users\\test.csv)
attach(D)
by1-factor(Class)
by2-factor(X)
some sample data.
John Kane
Kingston ON Canada
-Original Message-
From: ii54...@msn.com
Sent: Fri, 15 Mar 2013 12:40:54 +
To: r-help@r-project.org
Subject: [R] Data manipulation
Hello all,
I would appreciate your thoughts on a seemingly simple problem. I have
...@r-project.org] On
Behalf Of IOANNA
Sent: Freitag, 15. März 2013 13:41
To: r-help@r-project.org
Subject: [R] Data manipulation
Hello all,
I would appreciate your thoughts on a seemingly simple problem. I have a
database, where each row represent a single record. I want to aggregate
:11:48 +
To: jrkrid...@inbox.com, r-help@r-project.org
Subject: RE: [R] Data manipulation
Hello John,
I thought I attached the file. So here we go:
Class=c(1,1,1,1, 1,1,1,2,2,2,2,2,2,2,3,3,
3,3,3,3, 3,3,3)
X=c(0.1,0.1,0.1, 0.1,0.2,0.2,0.2
Nice. That does look like it. IOANNA?
John Kane
Kingston ON Canada
-Original Message-
From: nbla...@ispm.unibe.ch
Sent: Fri, 15 Mar 2013 14:27:03 +0100
To: ii54...@msn.com, r-help@r-project.org
Subject: Re: [R] Data manipulation
Is this what you want to do?
D2 - expand.grid
Thanks a lot!
-Original Message-
From: John Kane [mailto:jrkrid...@inbox.com]
Sent: 15 March 2013 13:41
To: Blaser Nello; IOANNA; r-help@r-project.org
Subject: Re: [R] Data manipulation
Nice. That does look like it. IOANNA?
John Kane
Kingston ON Canada
-Original Message
its clearer now.
Ioanna
-Original Message-
From: John Kane [mailto:jrkrid...@inbox.com]
Sent: 15 March 2013 12:51
To: IOANNA; r-help@r-project.org
Subject: RE: [R] Data manipulation
What zero values? And are they acutall zeros or are the NA's, that is,
missing values?
The code looks
@r-
project.org] On Behalf Of IOANNA
Sent: Friday, March 15, 2013 8:51 AM
To: 'John Kane'; 'Blaser Nello'; r-help@r-project.org
Subject: Re: [R] Data manipulation
Thanks a lot!
-Original Message-
From: John Kane [mailto:jrkrid...@inbox.com]
Sent: 15 March 2013 13:41
To: Blaser
'; 'Blaser Nello'; r-help@r-project.org
Subject: Re: [R] Data manipulation
Wouldn't this do the same thing?
xtabs(Count~Class+X, D)
--
David L Carlson
Associate Professor of Anthropology
Texas AM University
College Station, TX 77843-4352
Dear list,
I was curious how to subtract a vector from matrix?
Say, I have
mat - matrix(1:40, nrow=20, ncol=2)
x -c(1,2)
I want,
x-mat[1,] and x-mat[2,], and so on... Basically, subtract column elements
of x against column elements in mat.
But x-mat won't do it.
Thanks,
Mike
The only solution I found was
x-t(mu)
Is there a better way?
Mike
On Wed, Dec 5, 2012 at 1:30 PM, C W tmrs...@gmail.com wrote:
Dear list,
I was curious how to subtract a vector from matrix?
Say, I have
mat - matrix(1:40, nrow=20, ncol=2)
x -c(1,2)
I want,
x-mat[1,] and x-mat[2,],
Hi,
On Wed, Dec 5, 2012 at 1:30 PM, C W tmrs...@gmail.com wrote:
Dear list,
I was curious how to subtract a vector from matrix?
Say, I have
mat - matrix(1:40, nrow=20, ncol=2)
x -c(1,2)
Thanks for the actual reproducible example.
I want,
x-mat[1,] and x-mat[2,], and so on...
Thanks, Sarah. First time heard about sweep(), it worked just the way I
wanted.
Mike
On Wed, Dec 5, 2012 at 1:42 PM, Sarah Goslee sarah.gos...@gmail.com wrote:
Hi,
On Wed, Dec 5, 2012 at 1:30 PM, C W tmrs...@gmail.com wrote:
Dear list,
I was curious how to subtract a vector from matrix?
.
- Original Message -
From: C W tmrs...@gmail.com
To: Sarah Goslee sarah.gos...@gmail.com
Cc: r-help r-help@r-project.org
Sent: Wednesday, December 5, 2012 1:51 PM
Subject: Re: [R] data manipulation between vector and matrix
Thanks, Sarah. First time heard about sweep(), it worked just
: [R] data manipulation between vector and matrix
Thanks, Sarah. First time heard about sweep(), it worked just the way I
wanted.
Mike
On Wed, Dec 5, 2012 at 1:42 PM, Sarah Goslee sarah.gos...@gmail.com wrote:
Hi,
On Wed, Dec 5, 2012 at 1:30 PM, C W tmrs...@gmail.com wrote:
Dear list,
I
To: arun smartpink...@yahoo.com
Cc: R help r-help@r-project.org; Sarah Goslee sarah.gos...@gmail.com
Sent: Wednesday, December 5, 2012 4:11 PM
Subject: Re: [R] data manipulation between vector and matrix
thanks, I knew about apply, but did not you you can put plus signs with
quotes. That's a cool
A.K.
From: C W tmrs...@gmail.com
To: arun smartpink...@yahoo.com
Cc: R help r-help@r-project.org; Sarah Goslee sarah.gos...@gmail.com
Sent: Wednesday, December 5, 2012 4:11 PM
Subject: Re: [R] data manipulation between vector and matrix
thanks, I knew
: Re: [R] data manipulation between vector and matrix
Hi Arun,
Sorry, I might be a little unclear with my words.
The dimensions are different. This is what I got:
x-t(mat)
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14]
[1,] 0 -1 -2 -3 -4 -5 -6 -7
Message -
From: Filoche pmassico...@hotmail.com
To: r-help@r-project.org
Cc:
Sent: Tuesday, July 3, 2012 12:04 PM
Subject: [R] Data manipulation with aggregate
Hi everyone.
I have these data :
myData = data.frame(Name = c('a', 'a', 'b', 'b'), length = c(1,2,3,4), type
= c('x','x','y','z
Hi everyone.
I have these data :
myData = data.frame(Name = c('a', 'a', 'b', 'b'), length = c(1,2,3,4), type
= c('x','x','y','z'))
which gives me:
Name length type
1a 1x
2a 2x
3b 3y
4b 4 z
I would group (mean) this DF using 'Name' as
try this:
myData = data.frame(Name = c('a', 'a', 'b', 'b'), length = c(1,2,3,4), type
+ = c('x','x','y','z'))
result - do.call(rbind, lapply(split(myData, myData$Name), function(.name){
+ data.frame(Name = .name$Name[1L]
+ , length = mean(.name$length)
+ , type = if (all(.name$type[1L] ==
Hi all,
I'm trying to do some data manipulation using R, but I'm a bit stuck. I have
to warn you, I'm a real R noob.
I have for example this file:
V1 V2 V3 V4
V5V6
1:156706559
Thank you, that is much simpler!
On Thu, Dec 15, 2011 at 2:04 PM, Rui Barradas ruipbarra...@sapo.pt wrote:
Hello,
I believe I can help, or at least, my code is simpler.
First, look at your first line:
idd - length(diag(1,tt)) # length of intercept matrix
#
not needed: diag(tt) would
Dear R list,
I have the following data:
set.seed(1)
n - 5 # number of subjects
tt - 3 # number of repeated observation per subject
numco - 2 # number of covariates
x - matrix(round(rnorm(n*numco),2), ncol=numco) # the actual covariates
x
x
[,1] [,2]
[1,] -0.63 -0.82
[2,] 0.18
I'm sorry, the indices of my X matrix are wrong.
It should be:
X = x11 0 0 x12 0 0
0 x11 00 x12 0
0 0 x110 0 x12
x21 0 0 x22 0 0
0 x21 0
Hello,
I believe I can help, or at least, my code is simpler.
First, look at your first line:
idd - length(diag(1,tt)) # length of intercept matrix
#
not needed: diag(tt) would do the job but it's not needed,
why call 2 functions, and one of them, 'diag', uses memory(*), if the
result
Factors are you friend here:
myData
mydate gender mygroup id mygrp.f
1 2012-03-25 F A 1 1
2 2005-05-23 F B 2 2
3 2005-09-08 F B 2 2
4 2005-12-07 F B 2 2
5 2006-02-26 F C 2 3
6 2006-05-13 F
I have a data set with about 6 million rows and 50 columns. It is a
mixture of dates, factors, and numerics.
What I am trying to accomplish can be seen with the following
simplified data, which is given as dput output below.
head(myData)
mydate gender mygroup id
1 2012-03-25 F
Hi Juliet:
Here's a Q D solution:
# (1) plyr
f - function(d) length(unique(d$mygroup)) - 1
ddply(myData, .(id), f)
id V1
1 1 0
2 2 2
3 3 1
4 4 0
# (2) data.table
myDT - data.table(myData, key = 'id')
myDT[, list(nswitch = length(unique(mygroup)) - 1), by = 'id']
If one can switch
Thanks Dennis! I'll check this out.
Just to clarify, I need the total number of switches/changes
regardless of if that state
had occurred in the past. So A-A-B-A, would have 2 changes: A to B and B to A.
Thanks again.
On Wed, Aug 24, 2011 at 1:28 PM, Dennis Murphy djmu...@gmail.com wrote:
Hi
Hi,
I have a dataset with info on individuals (B) that have been involved in
projects (A) during multiple years (C). The dataset contains three columns:
A, B, C. Example:
A B C
1 1 a 1999
2 1 b 1999
3 1 c 1999
4 2 c 2001
5 2 d 2001
6 3 a 2004
7 3 b 2004
I am interested in the
mathijsdevaan mathijsdev...@gmail.com [Sat, Feb 12, 2011 at 03:00:18PM CET]:
Hi,
I have a dataset with info on individuals (B) that have been involved in
projects (A) during multiple years (C). The dataset contains three columns:
A, B, C. Example:
A B C
1 1 a 1999
2 1 b 1999
3
Will this do it for you:
x - read.table(textConnection( A B C
+ 1 1 a 1999
+ 2 1 b 1999
+ 3 1 c 1999
+ 4 2 c 2001
+ 5 2 d 2001
+ 6 3 a 2004
+ 7 3 b 2004), header = TRUE)
closeAllConnections()
# add a tenure column
x$tenure - ave(x$C, x$B, FUN = function(yr) yr - min(yr))
x
That worked great! Thanks!
--
View this message in context:
http://r.789695.n4.nabble.com/Data-manipulation-tp3302717p3303001.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing list
Hello,
I'd like to transpose data to create an analysis-friendly dataframe. See
below for an example, I was unable to use t(x) and I couldn't find a
function with options like PROC TRANSPOSE in SAS.
The ideal solution handles variable quantities of SITE - but beggars can't
be choosers. :-)
Hi Mike
reshape will be your friend.
reshape(RAW,direction=wide,timevar=SITE,idvar=USER_ID)
there is also the 'reshape'-package, which can do some more
sophisticated transformations.
hth.
Am 03.02.2011 20:41, schrieb Mike Schumacher:
Hello,
I'd like to transpose data to create an
Hi,
On Thu, Feb 3, 2011 at 2:41 PM, Mike Schumacher
mike.schumac...@gmail.com wrote:
Hello,
I'd like to transpose data to create an analysis-friendly dataframe. See
below for an example, I was unable to use t(x) and I couldn't find a
function with options like PROC TRANSPOSE in SAS.
The
Hi:
This also works, except that the result is of class 'table':
xtabs(COUNTS ~ USER_ID + SITE, data = RAW)
SITE
USER_ID SITE1 SITE2 SITE3
1101322
2101212
31344 0
4 0 099
If you need a data frame, then the earlier
On 2011-02-03 14:09, Dennis Murphy wrote:
Hi:
This also works, except that the result is of class 'table':
xtabs(COUNTS ~ USER_ID + SITE, data = RAW)
SITE
USER_ID SITE1 SITE2 SITE3
1101322
2101212
31344 0
4 0 0
On Thu, Feb 3, 2011 at 10:05 PM, Peter Ehlers ehl...@ucalgary.ca wrote:
On 2011-02-03 14:09, Dennis Murphy wrote:
Hi:
This also works, except that the result is of class 'table':
xtabs(COUNTS ~ USER_ID + SITE, data = RAW)
SITE
USER_ID SITE1 SITE2 SITE3
1 10 13 22
If this has already been answered, my apologies in advance I am relatively
new to this aspect of [R]. it is a bit of a basic question.
I have 4 columns of data (site, Date, measurement type, value) in a tab
delimited text file. Site is a site where measurements were collected,
Date is a date
Hi:
Please provide a minimal reproducible example that resembles your real data
so that people can try it out and provide potential solutions for you. Show
what you tried that failed, and what you expect. A number of people on this
list are very adept in data summarization, but most of them are
Hi,
I just started using R and need some guidance.
I need to create a time series chart in R, but the problem is the data is
not numeric.
The data is in the following format
Study
A
A
B
B
B
A
C
C
D
Then there is also another column with dates. How can I manipulate this in
order to have
Hi,
Look at the table() function. Here is an example with your data:
dat - read.table(textConnection(
Study
A
A
B
B
B
A
C
C
D), header = TRUE)
closeAllConnections()
table(dat)
Hope that helps,
Josh
On Fri, Sep 10, 2010 at 8:53 AM, dfong df...@medicine.umaryland.edu wrote:
Hi,
I just
I'm actually importing it from a CSV, so I already have that in a table. But
i Can't make a graph with text. I assume I need to do some counting in order
to draw the graph?
Any example of this?
thanks
--
View this message in context:
Hi,
Yes, the table() function is not to read the data, but to do the
frequency counts of each level. I just included the read.table() part
so that you could copy and paste my code, but I did not include the R
output from table(dat).
table(dat)
dat
A B C D
3 3 2 1
It nicely tallies for you.
Hello,
This is definitely possible with R, there a lots of package to make
good graphics.
However, the easiest way for us to help you is if you give us a small
reproducible example, as you started to with your initial post.
If you have an object in your R session that you'd like help with
you
Hi listers,
I made some search, but i didn`t find in the forum.
I have a data set.
I would like to make a search (conditon) on my data set.
x-c(1,2,3,4,5,6,7,8,9,10)
count-0
if (CONDITON){count-1}else{count-0}
My CONDITION would be: is there number 5 in my data set?
Thanks in advance,
Marcio
?match, look at the %in% operator.
Mestat wrote:
Hi listers,
I made some search, but i didn`t find in the forum.
I have a data set.
I would like to make a search (conditon) on my data set.
x-c(1,2,3,4,5,6,7,8,9,10)
count-0
if (CONDITON){count-1}else{count-0}
My CONDITION would be: is there
.)
Bert Gunter
Genentech Nonclinical Biostatistics
-Original Message-
From: r-help-boun...@r-project.org
[mailto:r-help-boun...@r-project.org] On
Behalf Of moleps
Sent: Monday, April 05, 2010 11:46 AM
To: r-help@r-project.org
Subject: [R] Data manipulation problem
Dear R´ers
Bert Gunter wrote:
Yes. Don't do this.
(what you probably really want to do is fit a model with age as a factor,
which can be done statistically e.g. by logistic regression; or
graphically
using conditioning plots, e.g. via trellis graphics (the lattice package).
This avoids the
-project.org] On
Behalf Of moleps
Sent: Monday, April 05, 2010 11:46 AM
To: r-help@r-project.org
Subject: [R] Data manipulation problem
Dear R´ers.
I´ve got a dataset with age and year of diagnosis. In order to
age-standardize the incidence I need to transform the data into a
matrix
with age-groups
-project.org
Subject: [R] Data manipulation problem
Dear R´ers.
I´ve got a dataset with age and year of diagnosis. In order to
age-standardize the incidence I need to transform the data
into a
matrix
with age-groups (divided in 5 or 10 years) along one axis and
year
divided
into 5 years along
Gunter
Genentech Nonclinical Biostatistics
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of moleps
Sent: Monday, April 05, 2010 11:46 AM
To: r-help@r-project.org
Subject: [R] Data manipulation problem
Dear R´ers.
I´ve got
Sent: Monday, April 05, 2010 11:46 AM
To: r-help@r-project.org
Subject: [R] Data manipulation problem
Dear R´ers.
I´ve got a dataset with age and year of diagnosis. In order to
age-standardize the incidence I need to transform the data into
a matrix
with age-groups (divided in 5 or 10 years
Genentech Nonclinical Biostatistics
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org
] On
Behalf Of moleps
Sent: Monday, April 05, 2010 11:46 AM
To: r-help@r-project.org
Subject: [R] Data manipulation problem
Dear R´ers.
I´ve got a dataset
1 - 100 of 167 matches
Mail list logo