[R] outer to vectors

jim holtman jholtman at gmail.com
Mon Feb 9 17:51:40 CET 2009


'combn' will give you the combinations that you can then use as
parameters in the function:

> combn(c('a', 'b', 'c'), 2)
     [,1] [,2] [,3]
[1,] "a"  "a"  "b"
[2,] "b"  "c"  "c"
>



On Mon, Feb 9, 2009 at 11:44 AM, patricia garcía gonzález
<kurtney_84 at hotmail.com> wrote:
>
> Hi all,
>
> Having a matrix A formed by n vectors as columns. Is there anything to calculate a determined function to all combination of vectors?
>
> For example imagine A matrix is compose by vectors a, b and c. And the function to perform is correlation, so I would like to obtain cor(a, b), cor(a, c) and cor(b, c).
>
> I we had numbers instead of vector, the function is outer, but I am not able to apply it to vectors...
>
> Thanks a lot.
>
> P.
>
>
>
>> Date: Mon, 9 Feb 2009 08:37:06 -0800
>> From: zznmeb at gmail.com
>> To: r-help at r-project.org
>> Subject: Re: [R] installing R on Ubuntu
>>
>> On Mon, Feb 9, 2009 at 4:51 AM, Neil Shephard <nshephard at gmail.com> wrote:
>> >
>> > The preceived "difficulty" of installing R under whatever flavour of
>> > GNU/Linux in this thread stems from being unfamiliar with the process of the
>> > package management of the flavour of GNU/Linux you use (and in part by the
>> > various distros not having the most recent version of R in their
>> > repositories.
>> >
>> > People who say "why can't it be as easy as dowloading a self-installing
>> > binary and running that" are trying to fit a round peg (their experience and
>> > understanding of how applications install in M$-windows) in a square hole
>> > (or triangular, hexagonal, or whatever depending on the distribution of
>> > GNU/Linux).
>>
>> This is true. However, for the most common Linux distros --Debian, Red
>> Hat Enterprise / CentOS / Scientific Linux / Fedora, openSUSE and
>> Ubuntu -- you can install the most recent R compiled for your distro
>> from
>>
>> http://<your-nearest-CRAN-mirror>/bin/linux/
>>
>> In addition, most of the distros have third-party repositories where
>> you can find the latest version of R. In short, if you have an x86 or
>> x86_64/amd64 system running almost any Linux, you can find a
>> pre-compiled R. R is a popular package, and it's pretty easy to find
>> even for Power PC or some of the obscure architectures.
>>
>> >
>> > There are pro's and con's to each of the GNU/Linux flavours and its really a
>> > matter of deciding which you like/have invested time in learning.
>> >
>> > Irrespective its still simple to install R from source under GNU/Linux...
>> >
>> > 1) Download source tar-ball
>> > 2) Extract and cd to the directory
>> > 3) ./configure --prefix=/where/you/want/R/to/go (optionally setting the
>> > install path at this stage)
>> > 4) ./make
>> > 5) ./make install
>> >
>> > ...all documented in the FAQ at
>> > http://cran.r-project.org/doc/FAQ/R-FAQ.html#How-can-R-be-installed-_0028Unix_0029
>>
>> Many Linux distros do *not* install the development tools by default,
>> and which ones live in which packages varies by distro. Fedora in
>> particular is extremely stripped when you install from the LiveCD. You
>> have to install gcc, make and a couple of other things just to install
>> VMware Tools, for example, when running Fedora as a VMware guest. For
>> building R from source and installing R packages, you'll also need to
>> install gfortran. And many libraries with external dependencies, like
>> Rgraphviz, will require not only the package itself (graphviz) but
>> also the C headers, which may have the name "graphviz-devel" on some
>> distros and some other name on other distros.
>> >
>> > This might not be as clean as using the native package management, but does
>> > mean that you'll have the latest version installed.
>> >
>> > Neil
>> >
>> > (Addendum - I've tried several different distros, starting with RedHat 7.3,
>> > then various versions of Slackware 8 through to 9 before settling on Gentoo,
>> > all were easy to install R in).
>>
>> I just recently switched from Gentoo to openSUSE. Gentoo usually had
>> the latest R source in their repository within a day or so of it
>> coming out of the R Project release cycle. To get it, all you needed
>> to do was put the package name in the "/etc/portage/package-keywords"
>> file. And Gentoo, since it is almost all compiled from source, by
>> nature *does* have all the development tools installed and installs
>> all the headers when it installs packages.
>>
>> --
>> M. Edward (Ed) Borasky
>>
>> I've never met a happy clam. In fact, most of them were pretty steamed.
>>
>> ______________________________________________
>> 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.
>
> _________________________________________________________________
>
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?




More information about the R-help mailing list