[R] Function to Normalize Numerical Vector in R

2009-09-07 Thread Gundala Viswanath
Is there any? - G.V. __ 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] Help with use of rep function in R

2009-09-07 Thread David Winsemius
On Sep 7, 2009, at 10:20 PM, Subodh Acharya wrote: Dear List,I am trying to use rep function in the following conditions A = c( 5, 6, 7, 11, 9, 12, 10, 15) B = c(12,15, 21, 31, 25, 27,32, *34*,13,12, 34, 33, 24, 29, 26, *28*,22,14,27,22,21,12,32, 16) I need to repeat each element of A, as

Re: [R] Function to Normalize Numerical Vector in R

2009-09-07 Thread David Winsemius
On Sep 7, 2009, at 11:24 PM, Gundala Viswanath wrote: Is there any? ?scale David Winsemius, MD Heritage Laboratories West Hartford, CT __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting

[R] Character manipulation using strsplit vectorization

2009-09-07 Thread Steven Kang
Dear R users, Suppose I have a data set with inconsistent names for a field. I desire to make these to consistent names. i.e University of New Jersey, New Jersey Uni, New Jersey University (3 different inconsistent names) to The University of New Jersey (consistent name) Below are arbitrary

Re: [R] Equivalence of Mann-Whitney test and Kruskal-Wallis test with k=2

2009-09-07 Thread David Scott
Thomas Farrar wrote: Hi all, The Kruskal-Wallis test is a generalization of the two-sample Mann-Whitney test to *k* samples. That being the case, the Kruskal-Wallis test with *k*=2 should give an identical p-value to the Mann-Whitney test, should it not? x1-c(1:5) x2-c(6,8,9,11)

Re: [R] Omnibus test for main effects in the faceofaninteraction containing the main effects.

2009-09-07 Thread Daniel Malter
John, as I wrote in the post sciptum, an anova on ML (but not REML) fitted models seems permissible (Faraway 2006, Extending the linear model with R, p. 158). I am certainly not an expert on this and there are better sources of information on why and when (e.g., Deepayan Sarkar, Julian Faraway,

[R] 3d scatter with trend line and errors

2009-09-07 Thread oleg lugovoy
Hello, Can anyone suggest a way to draw a plot similar to the example from Matlab ( http://www.mathworks.com/products/demos/fullsize.html?src=/products/demos/shipping/stats/orthoregdemo_03.png 3d plot with trend and errors in Matlab )? Thanks, oleg -- View this message in context:

Re: [R] Function to Normalize Numerical Vector in R

2009-09-07 Thread Daniel Malter
If you are looking for a function to standardize a variable so that it has mean zero and unit variance: std=function(x){if(length(which(is.na(x)))==0) (x-mean(x))/sd(x) else (x-mean(x,na.rm=T))/sd(x,na.rm=T) } x=rnorm(100,3,5) mean(x) sd(x) x2=std(x) mean(x2) sd(x2) HTH, Daniel

<    1   2