[R] Can a hyperlink be placed, thorugh R programming, on a graph?

2007-04-26 Thread Aldi Kraja
Hi,
If I use 

x-1:10
 y-rnorm(10,0,1)
### pdf(file=c:\\aldi\\test.pdf)
 plot(x,y)
 segments(x,y,x+2,y+2)
 segments(x,y,x+0.5,y+0.5,col=3)
### dev.off()
### q()

Is there a way that I can imbed in the graph plot for each point defined 
by x to x+0.5 and y to y+0.5 (and colored in green) a different hyperlink?

For example point one (together with the green tail) will have the 
hyperlink: www.r-project.org; point 2 with the link www.google.com; 
point 3 with the link www.yahoo.com etc.

So in general, can the graph be manupulated within R?

TIA,

Aldi

__
R-help@stat.math.ethz.ch 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] Can a hyperlink be placed, thorugh R programming, on a graph?

2007-04-26 Thread Aldi Kraja
Ok,

Here is a simple solution:
One can apply the text step (within a loop) for any other points and the 
hyperlinks are functional in the pdf format, and not viewable unless the 
mouse is over the link.
If you have a better solution, let me know.


x-1:10
 y-rnorm(10,0,1)
pdf(file=c:\\aldi\\test.pdf)
plot(x,y)
segments(x,y,x+2,y+2)
text(x[3],y[3],c(http://www.r-project.org;),cex=0.1,col=white)
segments(x,y,x+0.5,y+0.5,col=3)

dev.off()

Thanks,

Aldi


Aldi Kraja wrote:

Hi,
If I use 

x-1:10
 y-rnorm(10,0,1)
### pdf(file=c:\\aldi\\test.pdf)
 plot(x,y)
 segments(x,y,x+2,y+2)
 segments(x,y,x+0.5,y+0.5,col=3)
### dev.off()
### q()

Is there a way that I can imbed in the graph plot for each point defined 
by x to x+0.5 and y to y+0.5 (and colored in green) a different hyperlink?

For example point one (together with the green tail) will have the 
hyperlink: www.r-project.org; point 2 with the link www.google.com; 
point 3 with the link www.yahoo.com etc.

So in general, can the graph be manupulated within R?

TIA,

Aldi

__
R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] Plotting a broken line?

2007-03-07 Thread Aldi Kraja
Hi,

Is there a smart way in the R graphs to create a line that is broken in 
intervals based on the indicator given below.
following is a small test graph

Location,indicator,otherinfo
1.2,1,2.2
2.5,1,2.5
3.7,1,2.3
20.1,2,4.3

22.5,2,5.2
25.0,2,3.4
27.3,2,2.2

35.1,3,3.4
37.0,3,7.2
38.0,3,6.1
40.1,3,5.4
52.9,3,3.3

Right now in the plot the line is continuous, but I would like to have 
it broken based on the indicator. If the line of the plot reaches the 
last observation of indicator=1 then the line needs to stop; the next 
line will start at location 22.5 and continue up top 27.3; the next line 
goes from 35.1 up to 52.9.

  x-read.table(file='c:\\aldi\\testgraph.csv',sep=',',header=T)
  x
   Location indicator otherinfo
1   1.2 1   2.2
2   2.5 1   2.5
3   3.7 1   2.3
4  20.1 2   4.3
5  22.5 2   5.2
6  25.0 2   3.4
7  27.3 2   2.2
8  35.1 3   3.4
9  37.0 3   7.2
10 38.0 3   6.1
11 40.1 3   5.4
12 52.9 3   3.3

  
plot(x$Location,x$indicator,type='l',xlim=c(0,max(x$Location)),ylim=c(0,max(x$indicator,x$otherinfo)))
  points(x$Location,x$otherinfo)

TIA,
Aldi

--

__
R-help@stat.math.ethz.ch 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] Plotting a broken line?

2007-03-07 Thread Aldi Kraja
Hi Greg,

Thank you for your response and a previous posting about Macros in R.

Thank you also to Ken Knoblouch (Ken had the same idea as Greg's and 
Peter Pikal (who proposed the use of segments function).
There is only a technical specific that when applying max function to 
find the limit of y one has to use it with

max(x$indicator, na.rm =TRUE))

It worked!!!
  x
   Location indicator otherinfo
1   1.2 1   2.2
2   2.5 1   2.5
3   3.7 1   2.3
4   3.7NANA
5  20.1 2   4.3
6  22.5 2   5.2
7  25.0 2   3.4
8  27.3 2   2.2
9  27.3NANA
10 35.1 3   3.4
11 37.0 3   7.2
12 38.0 3   6.1
13 40.1 3   5.4
14 52.9 3   3.3

Aldi

Greg Snow wrote:

If you insert an NA (or row of NA's) into the data at each place you
want a break (after indicator increases), then the regular plot with
type='l' will break the line for you.

Is this what you want?

  


--

__
R-help@stat.math.ethz.ch 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 protect two jobs running on the same directory at the same time not to corrupt each other results:

2007-02-08 Thread Aldi Kraja
Hi,

I have a large group of jobs, some of them are running on the same 
directory.  All of them in batch mode.
What are the best ways to protect from corrupting the results two or 
more jobs running on the same directory.
One, I would think can be to run each job in a separate directory, 
collect the results and after remove the directories. But I have 
thousands of jobs that will run in parallel and I have placed about 100 
of them in each directory. They all do the same process, but on 
different variables, replications etc.

Is there any other solution better than creating separate directories in 
R? I am thinking if there is any option in R to create a unique id which 
has its own unique .Rdata, although in the same directory?

SAS for example to each batch job it assigns a different ID and a 
separate temp space, and does not mix it with another job running in 
parallel.

Thanks,

Aldi

--

__
R-help@stat.math.ethz.ch 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] Error: cannot take a sample larger than the population

2006-12-30 Thread Aldi Kraja
Hi,
In Splus7 this statement
xlrmN1 - sample(c(0,1,2),400 ,prob=c(0.02 ,0.93 ,0.05 ))
worked fine, but in R the interpreter reports that the length of the 
vector to chose c(0,1,2) is shorter than the size of many times I want 
to be selected from the vector c(0,1,2).
Any good reason?
See below the error.

  xlrmN1 - sample(c(0,1,2),400 ,prob=c(0.02 ,0.93 ,0.05 ))
Error in sample(length(x), size, replace, prob) :
cannot take a sample larger than the population
 when 'replace = FALSE'
Execution halted

TIA,

Aldi

--

__
R-help@stat.math.ethz.ch 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] Error: cannot take a sample larger than the population

2006-12-30 Thread Aldi Kraja
Partial Summary and discussion:
=
Thank you to Chao Gai, Chuck Cleland, and Jim Lemon for their suggestion 
to use replace=T in R.
There is a problem though (see below)

In the Splus7, sample is defined as
-
sample(x, size = n, replace = F, prob = NULL, n = NULL, ...)  where 
replace=F
In Splus7

xlrmN1 - sample(c(0,1,2),400 ,prob=c(0.02 ,0.93 ,0.05 ))

and the 

table(xlrmN1)/400
012
 0.02 0.93 0.05
show that sample is working exactly as expected based on the prob vector.

When sample is used in Splus7 with replacement we see the following 
result:
  xlrmN1 - sample(c(0,1,2),400 ,replace=T,prob=c(0.02 ,0.93 ,0.05 ))
  table(xlrmN1)/400
  0 1  2
 0.0125 0.925 0.0625
which I think is working again as expected.

In the R, sample is defined as
-

sample(x, size, replace = FALSE, prob = NULL)

So the above statement with replace=F did not work (reported error)
but with replace=T produced,

 table(xlrmN1)/400
xlrmN1
 0  1  2 
0.0200 0.9225 0.0575 

which is not exactly the sample with the probabilities provided (0.02,0.93,0.05)

Now let's return to the concept of replace=F and replace=T.
When I ask sample to select a sample of 400 from a vector of 3 with NO 
replacement, I would think the following
a). create a very large sample from 0, 1, and 2. b). From this large sample, 
based on the prob vector select without replacement.
c). As result I expect the probability of selected sample to be exactly the 
same with the prob vector (As in Splus7)

When I ask sample to select a sample of 400 from a vector of 3 with 
replacement, I would think the following
a). create a very large sample from 0, 1, and 2. b). From this large sample, 
based on the prob vector select with replacement, 
which means some of the previous selected 0, 1, 2 can be selected again.
c). As result I expect the probability of selected sample to be NOT exactly the 
same with the prob vector (As in Splus7 and R).

So there are two conclusions: sample in R is not working correct, OR I am 
missing some precision as a rounding error to produce

prob=c(0.02 ,0.93 ,0.05 ).
Am I misunderstanding the sample function in R?

Any suggestions are appreciated.
TIA,

Aldi

Aldi Kraja wrote:

Hi,
In Splus7 this statement
xlrmN1 - sample(c(0,1,2),400 ,prob=c(0.02 ,0.93 ,0.05 ))
worked fine, but in R the interpreter reports that the length of the 
vector to chose c(0,1,2) is shorter than the size of many times I want 
to be selected from the vector c(0,1,2).
Any good reason?
See below the error.

  xlrmN1 - sample(c(0,1,2),400 ,prob=c(0.02 ,0.93 ,0.05 ))
Error in sample(length(x), size, replace, prob) :
cannot take a sample larger than the population
 when 'replace = FALSE'
Execution halted

TIA,

Aldi

--

  


--

__
R-help@stat.math.ethz.ch 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] var-covar matrices comparison:

2006-02-21 Thread Aldi Kraja
Thank you Patrick for your thoughts.

I was expecting someone had written a function that does maybe a 
hierarchical comparison of var-covar matrices using the flury hierarchy 
as proposed by
Philips and Arnold in Evolution 53(5), 1999;1506-1515. But your email 
has an interesting idea, so I will try to test it.
Thank you,

Aldi

Patrick Burns wrote:

 My first thought is to use a random permutation test.
 In this setting the main question you need to ask is
 what distance measure do you want to use between
 variance matrices -- there are lots of choices.  One
 that I've found useful is the absolute value of the
 maximum eigenvalue of the difference of the matrices.

 If you have a hypothesis about how the variances may
 differ, then you should be able to come up with a more
 powerful statistic.

 Patrick Burns
 [EMAIL PROTECTED]
 +44 (0)20 8525 0696
 http://www.burns-stat.com
 (home of S Poetry and A Guide for the Unwilling S User)


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] var-covar matrices comparison:

2006-02-20 Thread Aldi Kraja
Hi,
Using package gclus in R, I have created some graphs that show the 
trends within subgroups of data and correlations among 9 variables (v1-v9).
Being interested for more details on these data I have produced also the 
var-covar matrices.
Question: From a pair of two subsets of data (with 9 variables each, I 
have two var-covar matrices for each subgroup, that differ for a 
treatment on one group (treatment A) vs (non-Treatment A).

Is there a software that can compare if two var-covar matrices are 
statistically the same?

Below are a pair of two matrices, from several others.
Thank you in advance for any input.
Aldi

 First group var-covar matrix (the data were under treatment a)

v1v2 v3  v4   v5   
v6   v7v8 v9

 

v1 730.87   3.406  -283.41-74.68   
107.57  -1355.13  -112.46  14.000   5.776

v2 3.41  24.950   105.45   -121.31  
-307.68   -285.4029.65  -2.500  -7.796

v3  -283.41 105.451  6292.19  -2676.46  
-970.80  29296.23 10715.29   3.156 -66.313

v4   -74.68-121.307 -2676.46 124492.30 
-2289.47 -20377.34  -409.71 183.500 563.102

v5   107.57-307.681  -970.80  -2289.47  
7045.62  12118.09   954.51  38.258  96.355

v6 -1355.13-285.404 29296.23 -20377.34 
12118.09 218555.93 70126.71 137.000-130.667

v7  -112.46  29.645 10715.29   -409.71   
954.51  70126.71 28239.57  67.989 -26.370

v814.00  -2.500 3.16183.50
38.26137.0067.99  24.500   9.000

v9 5.78  -7.796   -66.31563.10
96.35   -130.67   -26.37   9.000  22.776

 

 

 Second group var-covar matrix (the data were NOT under treatment a)

v1v2 v3  v4   v5   
v6   v7v8 v9

 

v1  2696.25   27.05   201.06   2745.54  
-344.39540.48654.20  34.363   7.623

v227.05   86.37   -96.89   -497.28 
-1185.10  -3108.71   -910.38  -4.254  -9.115

v3   201.06  -96.89 10647.26   8378.07  
 595.81  66122.43  26237.21 -65.093 -51.998

v4  2745.54 -497.28  8378.07 408391.25 
-3887.28  40477.40  30652.01 450.539  50.311

v5  -344.39-1185.10   595.81  -3887.28 
29204.00  65320.00  15238.41 -98.237 102.975

v6   540.48-3108.71 66122.43  40477.40 
65320.00 549955.14 194691.90-555.552 -95.210

v7   654.20 -910.38 26237.21  30652.01 
15238.41 194691.90  82698.88 -70.417 -75.585

v834.36   -4.25   -65.09450.54   
-98.24   -555.55-70.42  79.689   8.164

v9 7.62   -9.11   -52.00 50.31   
102.97-95.21-75.58   8.164  30.492

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] text miner:

2005-01-21 Thread Aldi Kraja
Hi,
Does a text miner exist in R-language similar to Splus miner or SAS text 
miner?
I would appreciate any information.
TIA,
Aldi

--
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] How to install a package that needs to see oher pkg dependencies:

2004-10-09 Thread Aldi Kraja
Hi,
I am trying to install the genetics package on a server with Linux, 
Fedora. I installed it in a PC and worked fine.

In a server since I am not used with R, I am not sure what do I need to 
change so genetics pkg can see some package dependencies:
Any suggestion is appreciated, Aldi

Note:
genetics expects gregmisc and mvtnorm to be installed already. gregmisc 
creates gdata etc dependencies.
So here is what I have done:
Retrieved the base R and installed and compiled it with make under :
/users/genetics/aldi/r/R/R-2.0.0

Under it directories:
/mvtnorm
/gregmisc
/genetics
are created.
Installed mvtnorm and gregmisc with no problem, but genetics is not 
recognizing the location of /gregmisc/gdata

The command I am using to install genetics package is the following:
../bin/R CMD ../bin/INSTALL genetics_1.1.0.tar.gz
Here is the problem:
[EMAIL PROTECTED]:/users/genetics/aldi/r/R-2.0.0/genetics% ../bin/R CMD 
../bin/INSTALL -l . genetics_1.1.0.tar.gz

* Installing *source* package 'genetics' ...
** R
** data
** inst
** preparing package for lazy loading
Error in loadNamespace(i[[1]], c(lib.loc, .libPaths()), keep.source) :
   There is no package called 'gdata'
Execution halted
ERROR: lazy loading failed for package 'genetics'
[EMAIL PROTECTED]:/users/genetics/aldi/r/R-2.0.0/genetics%
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html