Re: [R] need help with distribution graphics

2013-12-30 Thread capricy gao
Thanks a lot!





On Saturday, December 28, 2013 2:54 PM, Jim Lemon j...@bitwrit.com.au wrote:
 
On 12/29/2013 03:41 AM, capricy gao wrote:

 Really?

 OK, here the linked is an example:

 http://iai.asm.org/content/77/10/4631/F1.expansion.html


 Please, any input would be appreciated!


Hi Capricy,
Really. Try the beeswarm package or the ehplot or dendroPlot functions 
in the plotrix package.

Jim
[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] need help with distribution graphics

2013-12-28 Thread capricy gao
Really? 

OK, here the linked is an example:

http://iai.asm.org/content/77/10/4631/F1.expansion.html


Please, any input would be appreciated!




On Saturday, December 28, 2013 6:28 AM, Uwe Ligges 
lig...@statistik.tu-dortmund.de wrote:
 


On 28.12.2013 04:25, capricy gao wrote:
 I need to graph categorical data like a or b in the the following figure. 
 Could anybody let me know what command line I should go with?


Figures are removed when this goes to the mailing list, so nobody knows 
what you are talking about. Better provide a link to some web resource.

Best,
Uwe Ligges




 Thanks a lot!
     [[alternative HTML version deleted]]

 __
 R-help@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.


[[alternative HTML version deleted]]

__
R-help@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.


[R] need help with distribution graphics

2013-12-27 Thread capricy gao
I need to graph categorical data like a or b in the the following figure. Could 
anybody let me know what command line I should go with?

Thanks a lot!
[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] hist() : is there a way to change the border width?

2013-12-20 Thread capricy gao
Thanks a lot. It works!




On Thursday, December 19, 2013 10:53 PM, Jim Lemon j...@bitwrit.com.au wrote:
 
On 12/20/2013 08:19 AM, capricy gao wrote:

 I have played around with it and found that the only color could be changed. 
 But I really would like to change the width...

Hi Capricy,
Try this on the first example for hist:

hist(islands)
par(lwd=3)
hist(islands)

Jim
[[alternative HTML version deleted]]

__
R-help@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.


[R] hist() : is there a way to change the border width?

2013-12-19 Thread capricy gao
I have played around with it and found that the only color could be changed. 
But I really would like to change the width...

Thanks a lot :)

[[alternative HTML version deleted]]

__
R-help@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.


[R] plot() function: color transparency

2013-12-18 Thread capricy gao
I found all the color transparency was defined with character color, or rgb 
color. What if I have number code and still try to modify the transparency?

For example:

x=c(1:5)
 color=c(2,2,3,4,5)
 plot(x, col=color)
 plot(x, col=color,pch=20)

here I defined color by numbers, how can I modify the transparency?

Thanks a lot for any input!

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] plot() function: color transparency

2013-12-18 Thread capricy gao
I checked as you suggested. However, I found that the number in those functions 
are the number of colors. In contrast, my number here means a specific color, 
for example, 2 in my code means red, 3 in my code means green





On Wednesday, December 18, 2013 1:18 PM, Duncan Murdoch 
murdoch.dun...@gmail.com wrote:
 
On 13-12-18 2:08 PM, capricy gao wrote:

 I found all the color transparency was defined with character color, or rgb 
 color. What if I have number code and still try to modify the transparency?

 For example:

 x=c(1:5)
 color=c(2,2,3,4,5)
 plot(x, col=color)
 plot(x, col=color,pch=20)

 here I defined color by numbers, how can I modify the transparency?

See the examples for ?palette.

Duncan Murdoch
[[alternative HTML version deleted]]

__
R-help@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.


[R] Heatmap, and heatmap.2 gave different figures for the same dataset

2013-12-12 Thread capricy gao
I have a huge dataset(15k X 18) and tried to use the heatmap in R to examine 
the patterns. However, I found that heatmap and heatmap.2 gave me completely 
different outputs.

Here are the codes:



 dim(as.matrix(data.dcpm))
[1] 15462    18
 
 heatmap(as.matrix(data.dcpm), col=topo.colors(100))
 heatmap.2(as.matrix(data.dcpm), col=topo.colors(100), key=TRUE, 
 density.inf=none,trace=none, scale=none)
---

The outputs are attached here.

Could anyone help me figure out why?

Thanks a lot:)
__
R-help@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.


[R] method default for hclust function

2013-12-12 Thread capricy gao
I could not figure out what was the default when I ran hclust() without 
specifying the method.

For example:

I just have a code like:

hclust(dist(data))

Any input would be appreciated:)
[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Heatmap, and heatmap.2 gave different figures for the same dataset

2013-12-12 Thread capricy gao
Thank you very much for the hints. I fixed the problem.





On Thursday, December 12, 2013 2:08 PM, Kevin Wright kw.s...@gmail.com wrote:
 
Read the help page for both and pay particular attention to the scale 
argument.

Kevin Wright





On Thu, Dec 12, 2013 at 9:45 AM, capricy gao capri...@yahoo.com wrote:

I have a huge dataset(15k X 18) and tried to use the heatmap in R to examine 
the patterns. However, I found that heatmap and heatmap.2 gave me completely 
different outputs.

Here are the codes:



 dim(as.matrix(data.dcpm))
[1] 15462    18

 heatmap(as.matrix(data.dcpm), col=topo.colors(100))
 heatmap.2(as.matrix(data.dcpm), col=topo.colors(100), key=TRUE, 
 density.inf=none,trace=none, scale=none)
---

The outputs are attached here.

Could anyone help me figure out why?

Thanks a lot:)

__
R-help@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.




-- 
Kevin Wright
[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] problem with grep under loop

2013-09-17 Thread capricy gao
Thanks a lot. It works great now!






Cc: R help r-help@r-project.org 
Sent: Friday, September 13, 2013 11:46 PM
Subject: Re: [R] problem with grep under loop


Hi,
dat1- read.table(gao.txt,sep=,header=FALSE,stringsAsFactors=FALSE)
 dat1
#   V1 V2 V3   V4  V5  V6   V7   V8
#1 ref_gene_id ref_id class_code cuff_gene_id cuff_id FMI FPKM FPKM_conf_lo
#2   -  -  u  C.3   C.3.1 100 1.00 0.00
#3   -  -  u  C.2   C.2.1 100 1.00 0.00
#4   -  -  u  C.4   C.4.1 100 1.00 0.00
#5   -  -  u  C.1   C.1.1 100 1.00 0.00
#6   -  -  u  C.5   C.5.1 100 1.00 0.00
#    V9  V10 V11  V12   V13
#1 FPKM_conf_hi  cov len major_iso_id ref_match_len
#2 0.00 0.056682  96    C.3.1 -
#3 0.00 0.058453  99    C.2.1 -
#4 0.00 0.059634 101    C.4.1 -
#5 0.00 0.059634 101    C.2.1 -
#6 0.00 0.059634 101    C.5.1 -

You should read the dataset with  read.table(, header=TRUE) as your dataset 
already had colnames.

for(i in 1:nrow(dat1)){if(length(grep(dat1[i,4],dat1[i,12])==1)!=0) print(Y)}
[1] Y
[1] Y
[1] Y
[1] Y

A.K.



Sorry about that. I will try to reformat my question. 

I have a dataset with format like: 
-- 
 head(data) 
   V1 V2 V3   V4   V5  V6   V7   V8 
1 ref_gene_id ref_id class_code cuff_gene_id  cuff_id FMI FPKM FPKM_conf_lo 
2   -  -  u   C.3 C.3.1 100 1.00 0.00 
3   -  -  u   C.2 C.2.1 100 1.00 0.00 
4   -  -  u   C.4 C.4.1 100 1.00 0.00 
5   -  -  u   C.1 C.1.1 100 1.00 0.00 
6   -  -  u   C.5 C.5.1 100 1.00 0.00 
    V9  V10 V11  V12   V13 
1 FPKM_conf_hi  cov len major_iso_id ref_match_len 
2 0.00 0.056682  96 C.3.1 - 
3 0.00 0.058453  99 C.2.1 - 
4 0.00 0.059634 101 C.4.1 - 
5 0.00 0.059634 101 C.7.1 - 
6 0.00 0.059634 101 C.5.1 - 
- 
here column5 has extra .1 compared with column4, and column12 
might be different from column5 with similar format, for example row 5; 
but most of them (column5 and column12) are the same (like the rest of 
the rows) . I am trying to find the different ones by using grep 

this data has a dimension of  52086  by 13 

so my ran the following code: 
 
 dim(data) 
[1] 52086    13 
  if(grep(data[3,4],data[3,12])==1) print(Y) 
[1] Y 
 for(i in 1:52086){if(grep(data[i,4],data[i,12])==1) print (Y)} 
Error in if (grep(data[i, 4], data[i, 12]) == 1) print(Y) : 
  argument is of length zero 

--- 

here I tested the grep command first and it looks ok. However, when I put it in 
for loop, error message came: 
argument is of length zero 

Could you please help me figure out what happened here? 

Thanks a lot for your help. 




- Original Message -

To: r-help@r-project.org r-help@r-project.org
Cc: 
Sent: Friday, September 13, 2013 9:29 PM
Subject: [R] problem with grep under loop



I am just testing the possibility of using grep under for loop:

for(i in 1:10){grep(a,letters)}


nothing came out;

when I ran: 


grep(a,letters), 


I got 1

so in my for loop, I expected to see ten 1s, but I did not.

Could anybody help me to figure out why? Thanks a lot for your help.

Capricy
    [[alternative HTML version deleted]]

__
R-help@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.
[[alternative HTML version deleted]]

__
R-help@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.


[R] problem with grep under loop

2013-09-13 Thread capricy gao


I am just testing the possibility of using grep under for loop:

for(i in 1:10){grep(a,letters)}


nothing came out;

when I ran: 


grep(a,letters), 


I got 1

so in my for loop, I expected to see ten 1s, but I did not.

Could anybody help me to figure out why? Thanks a lot for your help.

Capricy
[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] problem with grep under loop

2013-09-13 Thread capricy gao
Thanks a lot for all the responses!!

I then first test my data:

 dim(data)
[1] 52086    13
  if(grep(data[3,4],data[3,12])==1) print(Y)
[1] Y
 for(i in 1:52086){if(grep(data[i,4],data[i,12])==1) print (Y)}
Error in if (grep(data[i, 4], data[i, 12]) == 1) print(Y) :
  argument is of length zero


What is this new error message? argument is of length zero

Here is my data format:
head(data)

   V1 V2 V3   V4   V5  V6   V7   V8
1 ref_gene_id ref_id class_code cuff_gene_id  cuff_id FMI FPKM FPKM_conf_lo
2   -  -  u   C.3 C.3.1 100 1.00 0.00
3   -  -  u   C.2 C.2.1 100 1.00 0.00
4   -  -  u   C.4 C.4.1 100 1.00 0.00
5   -  -  u   C.1 C.1.1 100 1.00 0.00
6   -  -  u   C.5 C.5.1 100 1.00 0.00
    V9  V10 V11  V12   V13
1 FPKM_conf_hi  cov len major_iso_id ref_match_len
2 0.00 0.056682  96 C.3.1 -
3 0.00 0.058453  99 C.2.1 -
4 0.00 0.059634 101 C.4.1 -
5 0.00 0.059634 101 C.2.1 -
6 0.00 0.059634 101 C.5.1 -



 From: Jeff Newmiller jdnew...@dcn.davis.ca.us

h...@r-project.org r-help@r-project.org 
Sent: Friday, September 13, 2013 9:21 PM
Subject: Re: [R] problem with grep under loop


This is because you are not printing it (with the print or cat functions). Keep 
in mind that the visible result you get from calling a function or evaluating a 
variable interactively comes from the interactive R command line, not from R 
itself. Once you put such an expression inside a function (such as the for 
function) it is no longer directly being invoked by the command interpreter.

You might want to read [1] and [2] (which says don't post using HTML).

[1] 
http://stackoverflow.com/questions/4716152/why-do-r-objects-not-print-in-a-function-or-a-for-loop
[2] http://www.R-project.org/posting-guide.html
---
Jeff Newmiller                        The     .       .  Go Live...
DCN:jdnew...@dcn.davis.ca.us        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
---
Sent from my phone. Please excuse my brevity.




I am just testing the possibility of using grep under for loop:

for(i in 1:10){grep(a,letters)}


nothing came out;

when I ran: 


grep(a,letters), 


I got 1

so in my for loop, I expected to see ten 1s, but I did not.

Could anybody help me to figure out why? Thanks a lot for your help.

Capricy
    [[alternative HTML version deleted]]

__
R-help@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.
[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] problem with grep under loop

2013-09-13 Thread capricy gao
Sorry about that. I will try to reformat my question.

I have a dataset with format like:
--
 head(data)
   V1 V2 V3   V4   V5  V6   V7   V8
1 ref_gene_id ref_id class_code cuff_gene_id  cuff_id FMI FPKM FPKM_conf_lo
2   -  -  u   C.3 C.3.1 100 1.00 0.00
3   -  -  u   C.2 C.2.1 100 1.00 0.00
4   -  -  u   C.4 C.4.1 100 1.00 0.00
5   -  -  u   C.1 C.1.1 100 1.00 0.00
6   -  -  u   C.5 C.5.1 100 1.00 0.00
    V9  V10 V11  V12   V13
1 FPKM_conf_hi  cov len major_iso_id ref_match_len
2 0.00 0.056682  96 C.3.1 -
3 0.00 0.058453  99 C.2.1 -
4 0.00 0.059634 101 C.4.1 -
5 0.00 0.059634 101 C.7.1 -
6 0.00 0.059634 101 C.5.1 -
-
here column5 has extra .1 compared with column4, and column12 might be 
different from column5 with similar format, for example row 5; but most of them 
(column5 and column12) are the same (like the rest of the rows) . I am trying 
to find the different ones by using grep

this data has a dimension of  52086  by 13

so my ran the following code:

 dim(data)
[1] 52086    13
  if(grep(data[3,4],data[3,12])==1) print(Y)
[1] Y
 for(i in 1:52086){if(grep(data[i,4],data[i,12])==1) print (Y)}
Error in if (grep(data[i, 4], data[i, 12]) == 1) print(Y) :
  argument is of length zero

---

here I tested the grep command first and it looks ok. However, when I put it in 
for loop, error message came: 
argument is of length zero

Could you please help me figure out what happened here?

Thanks a lot for your help.




 From: Jeff Newmiller jdnew...@dcn.davis.ca.us

ect.org 
Sent: Friday, September 13, 2013 10:36 PM
Subject: Re: [R] problem with grep under loop


Please read the Posting Guide before you post again, and study how to make a 
reproducible example of your problem [1], and change the settings on your mail 
program to send plain text. I, for one, am not psychic, so need things spelled 
out clearly.

[1] 
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example

---
Jeff Newmiller                        The     .       .  Go Live...
DCN:jdnew...@dcn.davis.ca.us        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
---
Sent from my phone. Please excuse my brevity.


[[elided Yahoo spam]]

I then first test my data:

 dim(data)
[1] 52086    13
  if(grep(data[3,4],data[3,12])==1) print(Y)
[1] Y
 for(i in 1:52086){if(grep(data[i,4],data[i,12])==1) print (Y)}
Error in if (grep(data[i, 4], data[i, 12]) == 1) print(Y) :
  argument is of length zero


What is this new error message? argument is of length zero

Here is my data format:
head(data)

   V1 V2 V3   V4   V5  V6  
V7   V8
1 ref_gene_id ref_id class_code cuff_gene_id  cuff_id FMI FPKM
FPKM_conf_lo
2   -  -  u   C.3 C.3.1 100 1.00
0.00
3   -  -  u   C.2 C.2.1 100 1.00
0.00
4   -  -  u   C.4 C.4.1 100 1.00
0.00
5   -  -  u   C.1 C.1.1 100 1.00
0.00
6   -  -  u   C.5 C.5.1 100 1.00
0.00
    V9  V10 V11  V12   V13
1 FPKM_conf_hi  cov len major_iso_id ref_match_len
2 0.00 0.056682  96 C.3.1 -
3 0.00 0.058453  99 C.2.1 -
4 0.00 0.059634 101 C.4.1 -
5 0.00 0.059634 101 C.2.1 -
6 0.00 0.059634 101 C.5.1 -



 From: Jeff Newmiller jdnew...@dcn.davis.ca.us

r-help@r-project.org r-help@r-project.org 
Sent: Friday, September 13, 2013 9:21 PM
Subject: Re: [R] problem with grep under loop
 

This is because you are not printing it (with the print or cat
functions). Keep in mind that the visible result you get from calling a
function or evaluating a variable interactively comes from the
interactive R command line, not from R itself. Once you put such an
expression inside a function (such as the for function) it is no
longer directly being invoked by the command interpreter.

You might want to read [1] and [2] (which says don't post using HTML).

[1]

Re: [R] still about biplot for principal componens analysis

2013-05-01 Thread capricy gao

Hi, Jim,

Thank you very much for your email.
 
Could you please explain more about the modification about how to adding this 
pch=1,cex=0.2 to the following command line?
biplot(pca2,xlabs=rep(.,19000))

The R document seems to only take text input, whereas pch=1,cex=0.2 are 
actually graphic parameters...


Also the question about points on the biplot are not exactly the same as the 
predicted values I asked in my previous post, I meant that when I checked the 
coordinates on the biplot, they are not matching to the pc1 and pc2 values in 
the predicted output I got from the following command

predict(pca2, originalData, ...)

Capricy



 From: Jim Lemon j...@bitwrit.com.au

Cc: r-help@r-project.org r-help@r-project.org 
Sent: Wednesday, May 1, 2013 5:33 AM
Subject: Re: [R] still about biplot for principal componens analysis


On 05/01/2013 02:46 AM, capricy gao wrote:
 I noticed that the points on the biplot are not exactly the same as the 
 predicted values.

 Could any body give me a  hint about why?

Hi capricy,
If you mean the points that would result from the suggestion I sent 
yesterday, it is probably because using the period (.) character 
places the dots a bit lower than the actual values. Try using:

pch=1,cex=0.2

Jim
[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] biplot for principal componens analysis

2013-04-30 Thread capricy gao


very helpful!! Thanks a lot.



 From: Jim Lemon j...@bitwrit.com.au

Cc: r-help@r-project.org r-help@r-project.org 
Sent: Monday, April 29, 2013 6:53 PM
Subject: Re: [R] biplot for principal componens analysis
 

On 04/30/2013 08:24 AM, capricy gao wrote:


 I did a PCA for my data which has a dimension of 19000X4 using princomp
 pca2=princomp((data), cor=F)





 and obtained a biplot with 19000 labels which were very busy. How can I just 
 show 19000 spot w/o labels?
 biplot(pca2)

Hi capricy,
I suppose you could try:

biplot(pca2,xlabs=rep(.,19000))

Jim
[[alternative HTML version deleted]]

__
R-help@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.


[R] still about biplot for principal componens analysis

2013-04-30 Thread capricy gao
I noticed that the points on the biplot are not exactly the same as the 
predicted values.

Could any body give me a  hint about why?

Thanks.





To: Jim Lemon j...@bitwrit.com.au 
Cc: r-help@r-project.org r-help@r-project.org 
Sent: Tuesday, April 30, 2013 9:51 AM
Subject: Re: [R] biplot for principal componens analysis




very helpful!! Thanks a lot.



From: Jim Lemon j...@bitwrit.com.au

Cc: r-help@r-project.org r-help@r-project.org 
Sent: Monday, April 29, 2013 6:53 PM
Subject: Re: [R] biplot for principal componens analysis


On 04/30/2013 08:24 AM, capricy gao wrote:


 I did a PCA for my data which has a dimension of 19000X4 using princomp
 pca2=princomp((data), cor=F)





 and obtained a biplot with 19000 labels which were very busy. How can I just 
 show 19000 spot w/o labels?
 biplot(pca2)

Hi capricy,
I suppose you could try:

biplot(pca2,xlabs=rep(.,19000))

Jim
    [[alternative HTML version deleted]]

__
R-help@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.
[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] still about biplot for principal componens analysis

2013-04-30 Thread capricy gao
Looks like my post might get some problems, so I re-wrote my question plus some 
new one...



I noticed that the points on the biplot are not exactly the same as the 
predicted values.

Another relevant question: should I expect that all the vector points have the 
same length if  chose parameters of cor=T ,
for example, pca2=princomp((data), cor=T)?


Could any body give me a  hint about  any of these questions?

Thanks.





To: Jim Lemon j...@bitwrit.com.au 
Cc: r-help@r-project.org r-help@r-project.org 
Sent: Tuesday, April 30, 2013 9:51 AM
Subject: Re: [R] biplot for principal componens analysis




very helpful!! Thanks a lot.



From: Jim Lemon j...@bitwrit.com.au

Cc: r-help@r-project.org r-help@r-project.org 
Sent: Monday, April 29, 2013 6:53 PM
Subject: Re: [R] biplot for principal componens analysis


On 04/30/2013 08:24 AM, capricy gao wrote:


 I did a PCA for my data which has a dimension of 19000X4 using princomp
 pca2=princomp((data), cor=F)





 and obtained a biplot with 19000 labels which were very busy. How can I just 
 show 19000 spot w/o labels?
 biplot(pca2)

Hi capricy,
I suppose you could try:

biplot(pca2,xlabs=rep(.,19000))

Jim
    [[alternative HTML version
 deleted]]

__
R-help@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.
[[alternative HTML version deleted]]

__
R-help@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.


[R] biplot for principal componens analysis

2013-04-29 Thread capricy gao


I did a PCA for my data which has a dimension of 19000X4 using princomp
pca2=princomp((data), cor=F)





and obtained a biplot with 19000 labels which were very busy. How can I just 
show 19000 spot w/o labels?
biplot(pca2)

Thanks a lot:))


-data

               A1         A2     L1                           L2
E_6  0.23  4.05 13.35   11.86
E_00011    118.74    177.87    144.20  136.05
E_00062  8.50  0.60 73.11   45.81
E_00070  1.31  4.92  0.98    1.23
E_00071 97.41 39.90 31.15  150.77
E_00104  0.00  0.43 18.93   31.28
.
.
.
.
.
.
.

.
.

E_18586  0.00   0.0  0.00    0.95
[[alternative HTML version deleted]]

__
R-help@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.


[R] plot in log scale in both x-axis and y-axis

2013-04-04 Thread capricy gao

I am trying to plot(x,y, log=y), which gives me log scale on y axis only. I 
wonder if there is way so that I can plot log scale on both of x and y axis.

Thanks a lot:)
[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] plot in log scale in both x-axis and y-axis

2013-04-04 Thread capricy gao


Thanks a lot.



 From: R. Michael Weylandt michael.weyla...@gmail.com

Cc: r-help@r-project.org r-help@r-project.org 
Sent: Thursday, April 4, 2013 3:41 PM
Subject: Re: [R] plot in log scale in both x-axis and y-axis



 I am trying to plot(x,y, log=y), which gives me log scale on y axis only. I 
 wonder if there is way so that I can plot log scale on both of x and y axis.

plot(x, y, log = 'xy')

Cheers,
MW


 Thanks a lot:)
         [[alternative HTML version deleted]]

 __
 R-help@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.
[[alternative HTML version deleted]]

__
R-help@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.


[R] looking for help with clustering analysis

2013-04-03 Thread capricy gao


My data have good correlations with spearman method and bad correlations with 
pearson method.

If I want to do cluster analysis to reflect the sprearman correlation, 
what method should I use to calculate the distance matrix? Thanks.

Xin

 



[[alternative HTML version deleted]]

__
R-help@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.


[R] Help on dendrogram reorder

2013-03-22 Thread capricy gao
I plot a dendrogram using the following code:

hc - hclust(dist(USArrests[1:10,]), ave)

unlist(as.dendrogram(hc))
 [1]  7  1  8  4  6 10  9  2  3  5

how can I easily flip some leaves so that the unlist results are: 

[1]  7  1  8  4  6 10  9  5 3 2

Thanks a lot!

[[alternative HTML version deleted]]

__
R-help@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.


[R] Need help to plot clara results [clustering]

2013-03-21 Thread capricy gao

I am going to use clara for  gene expression analysis, so tried to play around 
with the examples from R document:


http://127.0.0.1:10699/library/cluster/html/clara.html

Everything looked fine until I tried to plot the results: 

it says: waiting to confirm page change...

I waited for more than 10 min and NO plot came out...

Should I wait longer? Anything wrong like this?

Thanks for any input:)

And the code and results:
=
 x - rbind(cbind(rnorm(200,0,8), rnorm(200,0,8)),
+    cbind(rnorm(300,50,8), rnorm(300,50,8)))
 clarax - clara(x, 2, samples=50)
 clarax
Call:    clara(x = x, k = 2, samples = 50) 
Medoids:
   [,1]   [,2]
[1,] -0.9695444  0.3985362
[2,] 49.4829294 49.9229633
Objective function:  9.786942
Clustering vector:   int [1:500] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
Cluster sizes:   200 300 
Best sample:
 [1]   2  20  21  89  91 104 106 107 129 151 163 188 189 193 217 222 231 235 244
[20] 265 266 288 304 305 313 323 324 339 352 371 387 406 407 412 423 436 441 443
[39] 448 459 461 462 490 494

Available components:
 [1] sample medoids    i.med  clustering objective 
 [6] clusinfo   diss   call   silinfo    data  
 clarax$clusinfo
 size max_diss  av_diss isolation
[1,]  200 24.39542 9.871896 0.3450682
[2,]  300 27.28630 9.730307 0.3859591
 all.equal(clarax[-8],
+   clara(x, 2, samples=50, pamLike = TRUE)[-8])
[1] TRUE
 plot(clarax)
Waiting to confirm page change...
[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] How to subsetting data based on factor levels

2013-03-20 Thread capricy gao
Thanks a lot!










Cc: R help r-help@r-project.org 
Sent: Tuesday, March 19, 2013 8:39 PM
Subject: Re: [R] How to subsetting data based on factor levels

levels(group)
#[1] A C
 levels(group)==A
#[1]  TRUE FALSE
a[,group==A]
# A AB
#[1,] 1  6
#[2,] 2  7
#[3,] 3  8
#[4,] 4  9
#[5,] 5 10
a[,group==C]
#  C CD
#[1,] 11 16
#[2,] 12 17
#[3,] 13 18
#[4,] 14 19
#[5,] 15 20
a[,match(group,levels(group))==1]
# A AB
#[1,] 1  6
#[2,] 2  7
#[3,] 3  8
#[4,] 4  9
#[5,] 5 10




A.K.



- Original Message -

To: r-help r-help@r-project.org
Cc: 
Sent: Tuesday, March 19, 2013 9:19 PM
Subject: [R] How to subsetting data based on factor levels



Here are the code and results

 a=matrix(1:20,5)
 a
 [,1] [,2] [,3] [,4]
[1,]    1    6   11   16
[2,]    2    7   12   17
[3,]    3    8   13   18
[4,]    4    9   14   19
[5,]    5   10   15   20
 colnames(a)=c(A,AB,C,CD)
 a
 A AB  C CD
[1,] 1  6 11 16
[2,] 2  7 12 17
[3,] 3  8 13 18
[4,] 4  9 14 19
[5,] 5 10 15 20
 group=factor(substring(colnames(a),1,1))
 group
[1] A A C C
Levels: A C
 a[,levels(group)==A]
 A  C
[1,] 1 11
[2,] 2 12
[3,] 3 13
[4,] 4 14
[5,] 5 15
 a[,levels(group)==C]
 AB CD
[1,]  6 16
[2,]  7 17
[3,]  8 18
[4,]  9 19
[5,] 10 20

==
But, I was expect that:
a[,levels(group)==A]
 A  AB
[1,] 1 6
[2,] 2 7
[3,] 3 8
[4,] 4 9
[5,] 5 10

[[elided Yahoo spam]]
    [[alternative HTML version deleted]]


__
R-help@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.
[[alternative HTML version deleted]]

__
R-help@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.


[R] How to subsetting data based on factor levels

2013-03-19 Thread capricy gao


Here are the code and results

 a=matrix(1:20,5)
 a
 [,1] [,2] [,3] [,4]
[1,]    1    6   11   16
[2,]    2    7   12   17
[3,]    3    8   13   18
[4,]    4    9   14   19
[5,]    5   10   15   20
 colnames(a)=c(A,AB,C,CD)
 a
 A AB  C CD
[1,] 1  6 11 16
[2,] 2  7 12 17
[3,] 3  8 13 18
[4,] 4  9 14 19
[5,] 5 10 15 20
 group=factor(substring(colnames(a),1,1))
 group
[1] A A C C
Levels: A C
 a[,levels(group)==A]
 A  C
[1,] 1 11
[2,] 2 12
[3,] 3 13
[4,] 4 14
[5,] 5 15
 a[,levels(group)==C]
 AB CD
[1,]  6 16
[2,]  7 17
[3,]  8 18
[4,]  9 19
[5,] 10 20

==
But, I was expect that:
a[,levels(group)==A]
 A  AB
[1,] 1 6
[2,] 2 7
[3,] 3 8
[4,] 4 9
[5,] 5 10

Could anybody explain why? Thanks a lot!!
[[alternative HTML version deleted]]

__
R-help@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.


[R] easy way to install new R version??

2013-03-02 Thread capricy gao
Some packages have to be installed on new R version, 2.15.3

but I have 2.15.2

If I don't want to go through all download, and uninstall and install 
procedures, is there any simple R command that could handle this? Thanks.
[[alternative HTML version deleted]]

__
R-help@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.