Hello Dimitris, I was goggling for some help on Sensitivity vs 1-specificity and saw your link. I hope you can be of help to me in one of the issue that I am facing in generating combo chart(bar chart and plot). I am a novice and have some difficulty in getting this logic correct. I am give a dataset (I am attaching a sample dataset). I am using a barplot() and passing values for percentage frequency and the corresponding variables. I am struck here, what my function does is only calculate the frequency for the listed variables and not the frequency percentage. Is there a method or a script with which I can pass the frequency percent and the related values as category columns for x axis? I will attach the graphs that I have generated so that you can suggest the better way. Sampledata - Sampledata.txt What my function does to calculate the frequency with category names in X axis - 1.png My requirement is to generate percentage frequency of the variable in y1 and not the frequency itself. 2.png (where x categories are missing) Thanks, Sudha Krishnan -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: sampledata.txt URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130606/b6e65804/attachment.txt> -------------- next part -------------- A non-text attachment was scrubbed... Name: 1.png Type: image/png Size: 3263 bytes Desc: 1.png URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130606/b6e65804/attachment.png> -------------- next part -------------- A non-text attachment was scrubbed... Name: 2.png Type: image/png Size: 4135 bytes Desc: 2.png URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130606/b6e65804/attachment-0001.png>
generating a bar chart with two axis for co-linear variable
5 messages · Sudha Krishnan, John Kane, arun
I think we really need to see the code. John Kane Kingston ON Canada
-----Original Message----- From: sudha.krishnan at marlabs.com Sent: Thu, 6 Jun 2013 06:37:41 +0000 To: r-help at r-project.org Subject: [R] generating a bar chart with two axis for co-linear variable Hello Dimitris, I was goggling for some help on Sensitivity vs 1-specificity and saw your link. I hope you can be of help to me in one of the issue that I am facing in generating combo chart(bar chart and plot). I am a novice and have some difficulty in getting this logic correct. I am give a dataset (I am attaching a sample dataset). I am using a barplot() and passing values for percentage frequency and the corresponding variables. I am struck here, what my function does is only calculate the frequency for the listed variables and not the frequency percentage. Is there a method or a script with which I can pass the frequency percent and the related values as category columns for x axis? I will attach the graphs that I have generated so that you can suggest the better way. Sampledata - Sampledata.txt What my function does to calculate the frequency with category names in X axis - 1.png My requirement is to generate percentage frequency of the variable in y1 and not the frequency itself. 2.png (where x categories are missing) Thanks, Sudha Krishnan
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
____________________________________________________________ FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop!
HI,
May be this helps:
dat1<- read.table("sampledata.txt",header=TRUE,sep=",",stringsAsFactors=FALSE)
pdf("Barplots.pdf")
?lst1<-lapply(seq_len(ncol(dat1)),function(i) {Ctdat<- table(dat1[,i]);Ctdat1<-(Ctdat/sum(Ctdat))*100;barplot(Ctdat1,ylim=c(0,100),xlab=colnames(dat1)[i],ylab="Relative Frequency",main=paste("Barplot:",colnames(dat1)[i],sep=" "))})
dev.off()
A.K.
----- Original Message -----
From: Sudha Krishnan <Sudha.Krishnan at marlabs.com>
To: "r-help at r-project.org" <r-help at r-project.org>
Cc:
Sent: Thursday, June 6, 2013 2:37 AM
Subject: [R] generating a bar chart with two axis for co-linear variable
Hello Dimitris,
I was goggling for some help on Sensitivity vs 1-specificity and saw your link.
I hope you can be of help to me in one of the issue that I am facing in generating combo chart(bar chart and plot). I am a novice and have some difficulty in getting this logic correct.
I am give a dataset (I am attaching a sample dataset).
I am using a barplot() and passing values for percentage frequency and the corresponding variables. I am struck here, what my function does is only calculate the frequency for the listed variables and not the frequency percentage. Is there a method or a script with which I can pass the frequency percent and the related values as category columns for x axis?
I will attach the graphs that I have generated so that you can suggest the better way.
Sampledata - Sampledata.txt
What my function does to calculate the frequency with category names in X axis - 1.png
My requirement is to generate percentage frequency of the variable in y1 and not the frequency itself. 2.png (where x categories are missing)
Thanks,
Sudha Krishnan
______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
HI,
Not sure if this is what you wanted.
pdf("BarplotsNew.pdf")
library(plotrix)
lst2<-lapply(seq_len(ncol(dat1)),function(i){
??? ??? ??? ??? ??? Ctdat<- table(dat1[,i])
??? ??? ??? ??? ??? Ctdat1<-(Ctdat/sum(Ctdat))*100
??? ??? ??? ??? ??? dat2<-data.frame(Ctdat,Ctdat1,stringsAsFactors=FALSE)[,-3]
??? ??? ??? ??? ??? colnames(dat2)[3]<-"Rel.Freq"
??? ??? ??? ??? ??? dat2[,1]<- as.numeric(as.character(dat2[,1]))
??? ??? ??? ??? ??? with(dat2,twoord.plot(Var1,Rel.Freq,Freq,
??? ??? ??? ??? ??? ??? lylim=c(0,100),rylim=c(0,1000),
??? ??? ??? ??? ??? ??? ylab="Relative Frequency",
??? ??? ??? ??? ??? ??? rylab="Frequency",main=paste("Bar plot:",colnames(dat1)[i],sep=" "),
??? ??? ??? ??? ??? ??? type=c("bar","l"),lcol=2,rcol=4,xtickpos=Var1,xticklab=Var1))
??? ??? ??? ??? ??? ??? })
?dev.off()
A.K.
----- Original Message -----
From: arun <smartpink111 at yahoo.com>
To: Sudha Krishnan <Sudha.Krishnan at marlabs.com>
Cc: R help <r-help at r-project.org>
Sent: Thursday, June 6, 2013 2:44 PM
Subject: Re: [R] generating a bar chart with two axis for co-linear variable
HI,
May be this helps:
dat1<- read.table("sampledata.txt",header=TRUE,sep=",",stringsAsFactors=FALSE)
pdf("Barplots.pdf")
?lst1<-lapply(seq_len(ncol(dat1)),function(i) {Ctdat<- table(dat1[,i]);Ctdat1<-(Ctdat/sum(Ctdat))*100;barplot(Ctdat1,ylim=c(0,100),xlab=colnames(dat1)[i],ylab="Relative Frequency",main=paste("Barplot:",colnames(dat1)[i],sep=" "))})
dev.off()
A.K.
----- Original Message -----
From: Sudha Krishnan <Sudha.Krishnan at marlabs.com>
To: "r-help at r-project.org" <r-help at r-project.org>
Cc:
Sent: Thursday, June 6, 2013 2:37 AM
Subject: [R]? generating a bar chart with two axis for co-linear variable
Hello Dimitris,
I was goggling for some help on Sensitivity vs 1-specificity and saw your link.
I hope you can be of help to me in one of the issue that I am facing in generating combo chart(bar chart and plot). I am a novice and have some difficulty in getting this logic correct.
I am give a dataset (I am attaching a sample dataset).
I am using a barplot() and passing values for percentage frequency and the corresponding variables. I am struck here, what my function does is only calculate the frequency for the listed variables and not the frequency percentage. Is there a method or a script with which I can pass the frequency percent and the related values as category columns for x axis?
I will attach the graphs that I have generated so that you can suggest the better way.
Sampledata - Sampledata.txt
What my function does to calculate the frequency with category names in X axis - 1.png
My requirement is to generate percentage frequency of the variable in y1 and not the frequency itself. 2.png (where x categories are missing)
Thanks,
Sudha Krishnan
______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: BarplotsNew.pdf
Type: application/pdf
Size: 29361 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130606/4a9a0aae/attachment.pdf>
Arun,
Perfect, this is what I was looking for.
Thanks,
Sudha Krishnan
-----Original Message-----
From: arun [mailto:smartpink111 at yahoo.com]
Sent: Friday, June 07, 2013 2:36 AM
To: Sudha Krishnan
Cc: R help
Subject: Re: [R] generating a bar chart with two axis for co-linear variable
HI,
Not sure if this is what you wanted.
pdf("BarplotsNew.pdf")
library(plotrix)
lst2<-lapply(seq_len(ncol(dat1)),function(i){
??? ??? ??? ??? ??? Ctdat<- table(dat1[,i])
??? ??? ??? ??? ??? Ctdat1<-(Ctdat/sum(Ctdat))*100
??? ??? ??? ??? ??? dat2<-data.frame(Ctdat,Ctdat1,stringsAsFactors=FALSE)[,-3]
??? ??? ??? ??? ??? colnames(dat2)[3]<-"Rel.Freq"
??? ??? ??? ??? ??? dat2[,1]<- as.numeric(as.character(dat2[,1]))
??? ??? ??? ??? ??? with(dat2,twoord.plot(Var1,Rel.Freq,Freq,
??? ??? ??? ??? ??? ??? lylim=c(0,100),rylim=c(0,1000),
??? ??? ??? ??? ??? ??? ylab="Relative Frequency",
??? ??? ??? ??? ??? ??? rylab="Frequency",main=paste("Bar plot:",colnames(dat1)[i],sep=" "),
??? ??? ??? ??? ??? ??? type=c("bar","l"),lcol=2,rcol=4,xtickpos=Var1,xticklab=Var1))
??? ??? ??? ??? ??? ??? })
?dev.off()
A.K.
----- Original Message -----
From: arun <smartpink111 at yahoo.com>
To: Sudha Krishnan <Sudha.Krishnan at marlabs.com>
Cc: R help <r-help at r-project.org>
Sent: Thursday, June 6, 2013 2:44 PM
Subject: Re: [R] generating a bar chart with two axis for co-linear variable
HI,
May be this helps:
dat1<- read.table("sampledata.txt",header=TRUE,sep=",",stringsAsFactors=FALSE)
pdf("Barplots.pdf")
?lst1<-lapply(seq_len(ncol(dat1)),function(i) {Ctdat<- table(dat1[,i]);Ctdat1<-(Ctdat/sum(Ctdat))*100;barplot(Ctdat1,ylim=c(0,100),xlab=colnames(dat1)[i],ylab="Relative Frequency",main=paste("Barplot:",colnames(dat1)[i],sep=" "))})
dev.off()
A.K.
----- Original Message -----
From: Sudha Krishnan <Sudha.Krishnan at marlabs.com>
To: "r-help at r-project.org" <r-help at r-project.org>
Cc:
Sent: Thursday, June 6, 2013 2:37 AM
Subject: [R]? generating a bar chart with two axis for co-linear variable
Hello Dimitris,
I was goggling for some help on Sensitivity vs 1-specificity and saw your link.
I hope you can be of help to me in one of the issue that I am facing in generating combo chart(bar chart and plot). I am a novice and have some difficulty in getting this logic correct.
I am give a dataset (I am attaching a sample dataset).
I am using a barplot() and passing values for percentage frequency and the corresponding variables. I am struck here, what my function does is only calculate the frequency for the listed variables and not the frequency percentage. Is there a method or a script with which I can pass the frequency percent and the related values as category columns for x axis?
I will attach the graphs that I have generated so that you can suggest the better way.
Sampledata - Sampledata.txt
What my function does to calculate the frequency with category names in X axis - 1.png
My requirement is to generate percentage frequency of the variable in y1 and not the frequency itself. 2.png (where x categories are missing)
Thanks,
Sudha Krishnan
______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.