Slashdot Mirror


User: lt.+slock

lt.+slock's activity in the archive.

Stories
0
Comments
7
First seen
Last seen
Profile
(view on slashdot.org)

Comments · 7

  1. Re:eeebuntu on Which Distro For an Eee PC? · · Score: 2, Informative

    I'll second that. I've been using eeebuntu base on my 901 happily enough, battery life seems to be about 5 hours.

  2. Re:Show me some example code on The Power of the R Programming Language · · Score: 1

    Reply as AC below... error between chair and monitor

  3. Re:Show me some example code on The Power of the R Programming Language · · Score: 1

    Well, I haven't used MATLAB itself for a while - I do use Octave a bit though. So, try this

    a = sin

    In Octave I get

    error: sin: too few arguments

    instead i need to do

    a = @sin

    whereas the equivalent,

    a <- sin

    works in R. In other works, functions look just like other kinds of data in R, but a bit different in MATLAB (not much admittedly)

    Another difference, I think, is the way that scope works. Example: a function which, given n, returns a function which increments n (Paul Graham's incrementor exercise)

    f <- function(n){
        function() {
            n <<- n + 1
            n
        }
    }

    g <- f(2)
    h <- f(-3)

    g()
    #returns 3
    h()
    #returns -2
    g()
    #returns 4
    h()
    #returns -1

    Can you write this function, easily, in MATLAB?

  4. Re:Octave is more an alternative to MATLAB on The Power of the R Programming Language · · Score: 1

    Octave is great if you are moving from MATLAB to a free tool, because it has a similar syntax (IIRC it lags the MATLAB launguage by a couple of versions). But, in my view at any rate, R has a nicer language than either, and was well worth learning. You're right that R is stats oriented, but not some much that you feel crippled by it in use.

  5. Re:Show me some example code on The Power of the R Programming Language · · Score: 1

    cheers... don't do a lot of posting...

  6. Re:Show me some example code on The Power of the R Programming Language · · Score: 2, Informative

    note that the minus (as in f - function...) signs should be (left angle bracket minus sign), that is, the R assigmnent operator, I guess this is the lameness filter

  7. Re:Show me some example code on The Power of the R Programming Language · · Score: 5, Informative

    I use R a great deal. Think of it as an alternative to MATLAB, or Excel, rather than C or perl or lisp or whatever you like to use as a general purpose language. So, compared to MATLAB, functions are first class objects (rather like lisp), so, you can write functions that take functions as arguments, and return them as well, just as though
    they were simple variables. It handles
    vectors rather easily, and has decent plotting tools.

    #quick example

    # function, which, given numerical arguments a and b, and a function g, returns a function of x
    f - function(a,b, g){
        function(x){ a * x + g(b * x)}
    }

    f1 - f(1,2.5,sin)
    x - seq(-pi,pi,l=100)
    plot(x,f1(x),type='l')