Hi, this is probably a very basic question but I'm just learning R and i cannot find a function to standardize a data matrix.. I'll be grateful for any tips or help you can provide me. Thank you very much!
Did you mean this:> m <- matrix(1:12, 3, 4) > m / max(m)[,1] [,2] [,3] [,4] [1,] 0.08333333 0.3333333 0.5833333 0.8333333 [2,] 0.16666667 0.4166667 0.6666667 0.9166667 [3,] 0.25000000 0.5000000 0.7500000 1.0000000 On Thu, Jul 30, 2009 at 12:52 PM, Sam<samanta.fernandez at gmail.com> wrote:> Hi, > this is probably a very basic question but I'm just learning R and i > cannot find ?a function to standardize a data matrix.. > I'll be grateful for any tips or help you can provide me. > > Thank you very much! > > ______________________________________________ > 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. >
scale? This transforms the columns of a matrix to z-scores. That's one kind of standardisation. Bill Venables http://www.cmis.csiro.au/bill.venables/ -----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Sam Sent: Thursday, 30 July 2009 2:52 PM To: r-help at r-project.org Subject: [R] Function to standardize matriz? Hi, this is probably a very basic question but I'm just learning R and i cannot find a function to standardize a data matrix.. I'll be grateful for any tips or help you can provide me. Thank you very much! ______________________________________________ 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.
Dear Samanta, Take a look at ?scale. HTH, Jorge On Thu, Jul 30, 2009 at 12:52 AM, Sam <samanta.fernandez@gmail.com> wrote:> Hi, > this is probably a very basic question but I'm just learning R and i > cannot find a function to standardize a data matrix.. > I'll be grateful for any tips or help you can provide me. > > Thank you very much! > > ______________________________________________ > 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]]
Reasonably Related Threads
- lm coefficients output confusing
- weird to me interaction between time() and %%, %/%
- creating mulptiple new variables from one data.frame according to columns and rows in that frame
- aggregate by factor
- prop.test() and the simultaneous confidence interval for multiple proportions in R