[R] Populate matrix from data.frame

2007-06-28 Thread Andrej Kastrin
Dear all, I have a data frame a - data.frame(cbind(x=c('a','a','a','b','c'), y=c('a','b','c','d','e'),z=c(1,2,3,4,5))) a x y z 1 a a 1 2 a b 2 3 a c 3 4 b d 4 5 c e 5 and a matrix mm - matrix(0,5,5) colnames(mm) - c('a','b','c','d','e') rownames(mm) - c('a','b','c','d','e') mm a b c d e

[R] How to shadow 'power' area?

2007-06-25 Thread Andrej Kastrin
Dear all, Suppose I plot two normal distributions (A and B) side by side and add vertical line which hipotheticaly represent alpha value; e.g.: x - seq(-3.5,5, length=1000) y - dnorm(x) # Plot distribution A plot(y~x, type='l',axes=F,xlab=,ylab=,lwd=2) # Plot distribution B y2 - dnorm(x-1.5)

Re: [R] gower distance calculation

2006-11-17 Thread Andrej Kastrin
Roy Spitz pravi: Hello I have 2 rows in a matrix and I want to calculate the Gower Distance between the 2 , how can I do it? I searched and found nothing that can help me, and my program doesn't know the gdist function and I couldn't find it on the R help site. Can anyone help me

Re: [R] R in Nature

2006-08-25 Thread Andrej Kastrin
Simon Blomberg wrote: Hi all, We've just had a paper accepted for publication in Nature. We used R for 95% of our analyses (one of my co-authors sneaked in some GenStat when I wasn't looking.). The preprint is available from the Nature web site, in the open peer-review trial section. I

Re: [R] Kmeans - how to display results

2006-08-05 Thread Andrej Kastrin
What's wrong with cross-tabs? __ 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

[R] intersect() question

2006-07-15 Thread Andrej Kastrin
Hi, I have a matrix containing ID numbers in each column. I would like to program function which calculate common number of ID numbers between each pair of columns. Suppose: 5 6 7 1 5 3 6 7 2 Then the result should be: 0 2 0 2 0 1 0 1 0 The main problem is how to implement intersect()

Re: [R] intersect() question

2006-07-15 Thread Andrej Kastrin
inner - function(a,b=a,f=crossprod) apply(b,2,function(x)apply(a,2,function(y)f(x,y))) inner(mm, f = function(x,y) length(intersect(x,y))) * !diag(ncol(mm)) On 7/15/06, Andrej Kastrin [EMAIL PROTECTED] wrote: Hi, I have a matrix containing ID numbers in each column. I would like

[R] Discretize data.frame

2006-07-12 Thread Andrej Kastrin
Dear useRs, I use dics.ef function from dprep package to discretize continuous variable using intervals of equal frequencies. Dataset to be discretized include 4 continuous and 2 discrete variables in the following order: Continuous Countinuous Countinuous Discrete Discrete Continuous The

Re: [R] kmeans clustering

2006-06-29 Thread Andrej Kastrin
richard mendes wrote: Hello R list members, I'm a bio informatics student from the Leiden university (netherlands). We were asked to make a program with different clustering methods. The problem we are experiencing is the following. we have a matrix with data like the following

Re: [R] time series clustering

2006-06-06 Thread Andrej Kastrin
Spencer Graves wrote: I know of no software for time series clustering in R. Google produced some interesting hits for time series clustering. If you find an algorithm you like, the author might have software. Alternatively, the algorithm might be a modification of something

[R] Vector elements and ratios

2006-05-26 Thread Andrej Kastrin
Dear useRs, I have two different length vectors: one column (1...m) and one row vector (1...n): 20 40 20 60 5 4 2 Now I have to calculate ratios between column vector elements and each row vector elements: 4 5 10 8 10 20 4 5 20 15 12 30 Thank's in advance for any suggestions, Andrej

[R] rmeta: forest plot problem

2006-04-24 Thread Andrej Kastrin
Der useRs, I'm working on meta analysis using rmeta package. Using code below I plot the forest plot: library(rmeta) data (catheter) a-meta.MH (n.trt, n.ctrl, col.trt, col.ctrl, data=catheter, names=Name, subset=c(13,6,5,3,7,12,4,11,1,8,10,2)) summary(a) # odds ratio values and confidence

Re: [R] determining optimal # of clusters for a given dataset (e.g. between 2 and K)

2006-04-19 Thread Andrej Kastrin
andrew mcsweeny wrote: Hi: I'm clustering a microarray dataset with a large # of samples. I would like your opinion on the best way to automatically determine the optimal # of clusters. Currently I am using the cluster package, clustering with clara, examining the average

Re: [R] Maximum Likelihood Estimation

2006-04-03 Thread Andrej Kastrin
Uwe Ligges wrote: [EMAIL PROTECTED] wrote: Hi, I would like to know how to configure R so that I can enter some values and compute the Muximum likelihood estimation of my data. Maximum likelihood estimation of what? I do not know the definition of Maximum likelihood estimation

[R] Apply and more argumnts function

2006-03-04 Thread Andrej Kastrin
Dear useRs, shame on me, but I have no idea how to apply two arguments function on my data. I have 2 vectors, 'n' and 'm' and the function below: n - c(10,30,50,1000) m - c(10,50,100,200) MonteCarlo - function(n,m){ temp - NULL for(i in 1:m){ temp - c(temp,walk(n)) # walk is external

[R] for each element in matrix...

2006-02-05 Thread Andrej Kastrin
Dead R useRs, I wrote function, which plot dotchart from given matrix, compute mean from diagonal elements and plot it with abline. In addition, if particular element of matrix is greater then mean value (i.e. mead.diagonal), it should be plot in red, otherwise in green color. graph -

[R] image() and text

2006-02-04 Thread Andrej Kastrin
Dear useRs, I have 4×4 symmetrical matrix ; then I use image(log(my.matrix)) to visualise it. Is there any 'simple' way to add text labels into each cell lie on diagonal of the image plot? Thanks for any pointers... Cheers, Andrej __

[R] Regex question

2006-01-28 Thread Andrej Kastrin
Dear R useRs, is there any simple, build in function to match specific regular expression in data file and write it to a vector. I have the following text file: *NEW RECORD *ID-001 *AB-text *NEW RECORD *ID-002 *AB-text etc. Now I have to match all ID fields and print them to a vector: 001

Re: [R] Regex question

2006-01-28 Thread Andrej Kastrin
-', '', result) [1] 001 002 On 1/28/06, *Andrej Kastrin* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Dear R useRs, is there any simple, build in function to match specific regular expression in data file and write it to a vector. I have the following text file

[R] read.table problem

2006-01-25 Thread Andrej Kastrin
Dear R useRs, I have big (23000 rows), vertical bar delimited file: e.g. A1|Text a,Text b, Text c|345 A2|Text bla|456 ... .. . Try using A - read.table('filename.txt', header=FALSE,sep='\|') process stop at line 11975 with warning message: number of items read is not a multiple of

[R] Distance between axis and x.lab

2006-01-24 Thread Andrej Kastrin
Dear R useRs, what's the most elegant way to modify distance between x-axis and it's title. I didn't find any parameter to do that... Thank's in advance, cheers, Andrej __ R-help@stat.math.ethz.ch mailing list

Re: [R] packages about microarray analysis

2006-01-19 Thread Andrej Kastrin
Vincent Deng wrote: Dear R-helpers, Can anybody suggest me some common packages for standard microarray analysis, either from CRAN or Bioconductor? Many thanks... [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list

[R] For each element in vector do...

2006-01-17 Thread Andrej Kastrin
Dear R useRs, I have a vector with positive and negative numbers: A=c(0,1,2,3,0,4,5) Now if i-th element in vector A is 0, then i-th element in vector B is a+1 else i-th element in vector b=a (or 0) vector A: 0 1 2 3 0 4 5 vector B: 0 2 3 4 0 5 6 What's the right way to do this. I still

[R] Problem with plot()

2006-01-16 Thread Andrej Kastrin
Dear R useRs, I have a problem to add title to the following graphics; Tukey=TukeyHSD(aov(CA~C), C,ordered=TRUE)) plot (Tukey, main=My first graph) actually, it draw a graph, but it also display: parameter main could not be set in high-level plot() function. If I execute:

[R] Equal length axis

2006-01-15 Thread Andrej Kastrin
Dear useRs, I am having difficulty to plot graphics with mfrow command, where both axis are equal length. Below is sample code, which plots rectangles instead of squares: par (mfrow=c(3,3)) qqnorm(a) qqnorm(b) ... .. Thanks in advance for any pointers or notes.

Re: [R] Equal length axis

2006-01-15 Thread Andrej Kastrin
Andrej Kastrin wrote: Dear useRs, I am having difficulty to plot graphics with mfrow command, where both axis are equal length. Below is sample code, which plots rectangles instead of squares: par (mfrow=c(3,3)) qqnorm(a) qqnorm(b) ... .. Thanks in advance for any pointers or notes

[R] Multiple comparison and two-way ANOVA design

2006-01-15 Thread Andrej Kastrin
Dear useRs, I'm working on multiple comparison design on two factor (2 × 3 levels) ANOVA. Each of the tests I have tried (Tukey, multcomp package) seem to do only with one factor at a time. fm1 - aov(breaks ~ wool * tension, data = warpbreaks) tHSD - TukeyHSD(fm1, tension, ordered = FALSE)

[R] Split graph labels in 2 levels

2005-12-29 Thread Andrej Kastrin
Dear R users, is there any simple low-level function that split single-line graph labels and produce something like (e.g. for x axis): 100300500 700... 200400 600 Cheers, Andrej __ R-help@stat.math.ethz.ch mailing list