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] <-
"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 wrote
Cowpertwait.
--
David.
>
>>
>> --
>> David.
>>>
>>> If it does not get through will do a dput as the file is only 7K
>>>
>>> Regards
>>>
>>> Duncan
>>> Duncan Mackay
>>> Department of Agronomy and
> 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 wrote:
>>
>> Hi
>>
>> Coming late t
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
gt; 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 manipulatio
-
> 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.
> As for your data, your u
ui 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 source of your info
nt 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]
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 AM, John Kane via R-he
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 something. Since we ha
half 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";)
Error in
352
>
>
>
> -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 manipulation
>
> Hell
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";)
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(f
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,
Thank
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 access to data file about PS
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 us what error message you go
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
http://mas
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 <-paste(colnames(A[
,1,0,0,0,0),
>
> C=c(0,0,0,0,1,1,0,0),
>
> D=c(1,0,0,0,0,0,1,0),
>
>Variable=c(D,B,B,B,C,C,D,none))
>
> Thanks in advance,
> IOanna
>
>
> -Original Message-
> From: arun [mailto:smartpink...@yahoo.com]
> Sent
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, 2014 6:48 PM, arun wrote:
Hi,
May be this helps:
A$V
t; D=c(1,0,0,0,0,0,1,0),
>
>Variable=c(D,B,B,B,C,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
&
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.
On Thursday, Fe
... 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
Also,
rownames(which(t(!!A[,-1]),arr.ind=TRUE))
A.K.
On Thursday, February 20, 2014 6:48 PM, arun 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 wrote:
Hello,
Assuming that I have a da
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 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),
age-
From: r-help-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
s,Phil
> From: pmassico...@hotmail.com
> To: r-help@r-project.org
> Date: Fri, 22 Nov 2013 18:17:03 +0000
> Subject: Re: [R] data manipulation
>
> Thank you everyone for your suggestions.
>
> > Date: Fri, 22 Nov 2013 18:04:16 +
> > From: pbu...@pburns.seanet.com
> &g
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
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) <
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
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 w
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
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,
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 <-
data.frame(X=i,Y1=unlist(Y1[i,]
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 values.
On 15-05-2013, at 08:15, 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, bu
vid L Carlson
> Sent: Friday, March 15, 2013 9:23 AM
> To: 'IOANNA'; 'John Kane'; 'Blaser Nello'; r-help@r-project.org
> Subject: Re: [R] Data manipulation
>
> Wouldn't this do the same thing?
>
> xtabs(Count~Class+X, D)
>
> ---
[mailto:r-help-bounces@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
Thanks again. I hope 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,
m
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 Mess
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 yo
i, 15 Mar 2013 13: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,
Is this what you want to do?
D2 <- expand.grid(Class=unique(D$Class), X=unique(D$X))
D2 <- merge(D2, D, all=TRUE)
D2$Count[is.na(D2$Count)] <- 0
W <- aggregate(D2$Count, list(D2$Class, D2$X), "sum")
W
Best,
Nello
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-bou
What zero values? And are they acutall zeros or are the NA's, that is, missing
values?
The code looks okay but without some sample data it is difficult to know
exactly what you are doing.
The easiest way to supply data is to use the dput() function. Example with
your file named "testfile":
HI,
The option z5 takes care of it.
z5<-t(x-t(mat)) #still faster than ?sweep()
dim(z5)
[1] 20 2
identical(sweep(-mat,2,x,"+"),z5)
#[1] TRUE
A.K.
From: C W
To: arun
Sent: Wednesday, December 5, 2012 5:09 PM
Subject: Re: [R] data manipul
ystem elapsed
# 0.008 0.000 0.009
A.K.
From: C W
To: arun
Cc: R help ; Sarah Goslee
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 plu
0.008 0.000 0.009
>
>
> A.K.
>
>
>
>
>
> ____________
> From: C W
> To: arun
> Cc: R help ; Sarah Goslee
> Sent: Wednesday, December 5, 2012 4:11 PM
> Subject: Re: [R] data manipulation between vector and matrix
>
>
>
HI,
In addition to ?sweep(), you can use
apply(-mat,1,`+`,x)
#or
library(plyr)
aaply(-mat,1,"+",x)
A.K.
- Original Message -
From: C W
To: Sarah Goslee
Cc: r-help
Sent: Wednesday, December 5, 2012 1:51 PM
Subject: Re: [R] data manipulation between vector and matr
aaply(-mat,1,"+",x)
>
>
> A.K.
>
>
>
>
>
>
> - Original Message -
> From: C W
> To: Sarah Goslee
> Cc: r-help
> Sent: Wednesday, December 5, 2012 1:51 PM
> Subject: Re: [R] data manipulation between vector and matrix
>
> Thanks, Sarah. First time
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 wrote:
> Hi,
>
> On Wed, Dec 5, 2012 at 1:30 PM, C W wrote:
> > Dear list,
> > I was curious how to subtract a vector from matrix?
> >
> > Say, I have
> >
> > mat <
Hi,
On Wed, Dec 5, 2012 at 1:30 PM, C W 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... Basically, su
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 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,], and so
Hi,
Try this:
myData = data.frame(Name = c('a', 'a', 'b', 'b'), length = c(1,2,3,4), type=
c('x','x','y','z'))
z<-aggregate(length~Name,myData,mean)
z1<-aggregate(length~type,myData,mean)
merge(z,merge(z,z1),all=TRUE)
Name length type
1 a 1.5 x
2 b 3.5
A.K.
- Original
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] == .
Thank you, that is much simpler!
On Thu, Dec 15, 2011 at 2:04 PM, Rui Barradas 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 do the job bu
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
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
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
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 wrote:
> Hi Juliet:
>
> Here'
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 sw
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
https://stat.ethz.ch/mailm
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)
mathijsdevaan [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 1 c 1999
>
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 lo
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 c
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. A
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:
http://r.789695.n4.nabble.com/Data-Manipulation-tp2534662p253
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 wrote:
>
> Hi,
>
> I just started using R and nee
?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 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
In the end after going at it from scratch...This worked out allright...
##set up data
age.cat<-seq(0,100,10)
year<-(1953:(1953+55))
dat.vec<-sample(1:10,(length(age.cat)*length(year)))
dat.matrix<-matrix(dat.vec,c(length(age.cat),length(year)))
rownames(dat.matrix)<-age.cat
colnames(
That code throws multiple errors. Can you at least test your code
before posting?
(And, again, please avoid using function names as names for your
objects.)
-- David.
On Apr 7, 2010, at 8:54 AM, moleps islon wrote:
So.. here we try again.
##generate dataset
age.cat<-seq(0,100,10)
year<-
So.. here we try again.
##generate dataset
age.cat<-seq(0,100,10)
year<-(1953:(1953+55))
data.vec<-sample(1:1,(age.cat*year))
data.matrix<-matrix(data.vec,c(length(age.cat),length(year))
rownames(data.matrix)<-age.cat
colnames(data.matrix)<-year
##divide into 5 year periods
age.div<-cut(y
On Apr 6, 2010, at 3:30 PM, David Winsemius wrote:
On Apr 6, 2010, at 9:56 AM, moleps islon wrote:
OK... next question.. Which is still a data manipulation problem so I
believe the heading is still OK.
##So now I read my population data from excel.
No, you read it from a text file and pro
On Apr 6, 2010, at 9:56 AM, moleps islon wrote:
OK... next question.. Which is still a data manipulation problem so I
believe the heading is still OK.
##So now I read my population data from excel.
No, you read it from a text file and providing the first ten lines of
that text file should
OK... next question.. Which is still a data manipulation problem so I
believe the heading is still OK.
##So now I read my population data from excel.
pop<-read.csv("pop.csv")
typeof(pop) ## yields a list where I have age-specific population rows
and a yearly column population, where the years are
Thx Erik,
I have no idea what went wrong with the other code snippet, but this one
works.. Appreciate it.
qta<- table(cut(age,breaks = seq(0, 100, by = 10),include.lowest =
TRUE),cut(year,breaks=seq(1950,2010,by=5),include.lowest=TRUE))
M
On 5. apr. 2010, at 21.45, Erik Iverson wrote:
> I d
I don't know what your data are like, since you haven't given a
reproducible example. I was imagining something like:
## generate fake data
age <- sample(20:90, 100, replace = TRUE)
year <- sample(1950:2000, 100, replace = TRUE)
##look at big table
table(age, year)
## categorize data
## see in
I already did try the regression modeling approach. However the epidemiologists
(referee) turns out to be quite fond of comparing the incidence rates to
different standard populations, hence the need for this labourius approach.
And trying the "cutting" approach I ended up with :
> table (age5)
You have tempted, and being weak, I yield to temptation:
"Any good ideas?"
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
?cut to create categories
?table to make the table
moleps wrote:
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
On 01/26/2010 09:15 PM, Peter Rote wrote:
I still struggling with this:
error massage:
by(AlexETF,AlexETF$Industry,function(a) {filename = paste("C:/ab/",gsub("
","",a$Industry[1]),".txt",sep="")
+ print(filename)
+ write.table(a[,3,drop=FALSE],quote=FALSE,col.names=FALSE,row.nam
Peter Rote wrote:
> I still struggling with this:
>
> error massage:
>
>> by(AlexETF,AlexETF$Industry,function(a) {filename = paste("C:/ab/",gsub("
>> ","",a$Industry[1]),".txt",sep="")
> + print(filename)
> + write.table(a[,3,drop=FALSE],quote=FALSE,col.names=FALSE,row.names=FALSE)
I still struggling with this:
error massage:
> by(AlexETF,AlexETF$Industry,function(a) {filename = paste("C:/ab/",gsub("
> ","",a$Industry[1]),".txt",sep="")
+ print(filename)
+ write.table(a[,3,drop=FALSE],quote=FALSE,col.names=FALSE,row.names=FALSE)
+ }
+ )
[1] "C:/ab/Acc
Thank you Don for the code,
but I get the following error massage:
> by(AlexETF,AlexETF$Industry,function(a) {filename = paste("C:/ab/",gsub("
> ","",a$Industry[1]),".txt",sep="")
+ print(filename)
+ write.table(a[,3,drop=FALSE],quote=FALSE,col.names=FALSE,row.names=FALSE)
+ }
Does this example help?
a <- matrix(letters[1:12], ncol=3)
a
[,1] [,2] [,3]
[1,] "a" "e" "i"
[2,] "b" "f" "j"
[3,] "c" "g" "k"
[4,] "d" "h" "l"
write.table(a[,3,drop=FALSE],quote=FALSE,col.names=FALSE,row.names=FALSE)
i
j
k
l
At 4:11 PM -0800 1/21/10, Peter Rote wrote:
T
Thank you Dieter and Rolf,
I have solved the slash Problem, but I still struggling with the output
files.
I have tried this
by(AlexETF,AlexETF$Industry,function(a) {filename = paste("C:/ab/",gsub("
","",a$Industry[1]),".txt",sep="")
print(filename)
write.table(a,file=filename,c
Peter Rote wrote:
>
>
> but i still have a problem to write to file. The problem is the slash in
> file names (Aerospace/Defense Products & Services ). If i want it to
> C:/ab/
> so "C:/ab/AdvertisingAgencies.txt" is ok but
> "C:/ab/Aerospace/Defense-MajorDiversified.txt" is not
>
>
As Rol
A name such as ``Aerospace/Defense etc.'' is certainly not a legal
file name under unix-alike systems, and I suspect it would not
be even under Windoze. Even if it is, you shouldn't use it!
Change the name to ``Aerospace-Defense Products & Services''
or something like that, for goodness sake.
by the way how do i change the output
"1016" "Advertising Agencies" "CMM"
"1803" "Advertising Agencies" "FMCN"
"2427" "Advertising Agencies" "IPG"
"3093" "Advertising Agencies" "MWW"
"3372" "Advertising Agencies" "OMC"
"4809" "Advertising Agencies" "VCLK"
"4832" "Advertising Agencies" "VISN"
"500
Thank you Dieter,
but i still have a problem to write to file. The problem is the slash in
file names (Aerospace/Defense Products & Services ). If i want it to C:/ab/
so "C:/ab/AdvertisingAgencies.txt" is ok but
"C:/ab/Aerospace/Defense-MajorDiversified.txt" is not
> head(AlexETF)
Peter Rote wrote:
>
> I would like to to group the Ticker by Industry and create file names from
> the
> Industry Factor and export to a txt file.
>
> I have tried the folowing
>
> ind=finvizAllexETF$Industry
>
> ind is then "Aluminum" "Business Services" "Regional Airlines"
>
>
try this:
myDat <- read.table(textConnection("group id
1 101
1 201
1 301
2 401
2 501
2 601
3 701
3 801
3 901"),header=TRUE)
closeAllConnections()
corr_mat <-as.matrix(read.table(textConnection("1 1 .5 0 0 0 0
0 0 0
2 .5 1 0 0 0 0 0 0 0
3 00 1.0 0 0 0 0 0
This is probably far more discussion than the question warranted, but...
On Thu, Dec 3, 2009 at 11:14 PM, David Winsemius wrote:
>
> On Dec 3, 2009, at 10:52 PM, Gray Calhoun wrote:
>
>> The data import/export manual can elaborate on a lot of these; this is
>> all straightforward, although many p
On Thu, Dec 3, 2009 at 9:52 PM, John Filben wrote:
> Can R support data manipulation programming that is available in the SAS
> datastep? Specifically, can R support the following:
> - Read multiple dataset one record at a time and compare values from
> each; then base on if-then logic
On Dec 3, 2009, at 10:52 PM, Gray Calhoun wrote:
The data import/export manual can elaborate on a lot of these; this is
all straightforward, although many people would prefer to use a
relational database for some of the things you mentioned.
See Wickham's pithy response to this.
I'm not
awa
The data import/export manual can elaborate on a lot of these; this is
all straightforward, although many people would prefer to use a
relational database for some of the things you mentioned. I'm not
aware of a "goto" command in R, though (although I could be wrong).
--Gray
On Thu, Dec 3, 2009 a
Please refrain from posting HTML. The results can be incomprehensible:
On 2009.12.03 13:52:09, John Filben wrote:
> Can R support data manipulation programming that is available in the SAS
> datastep??? Specifically, can R support the following:
> -?? Read multiple dataset one rec
1 - 100 of 130 matches
Mail list logo