Forgot your password?
typodupeerror

Comment: Re:Show me some example code (Score 1) 382

by lt. slock (#26383999) Attached to: The Power of the R Programming Language

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?

Comment: Re:Octave is more an alternative to MATLAB (Score 1) 382

by lt. slock (#26369863) Attached to: The Power of the R Programming Language

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.

Comment: Re:Show me some example code (Score 5, Informative) 382

by lt. slock (#26366715) Attached to: The Power of the R Programming Language

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')

Microsoft

+ - Microsoft uses legacy formats to push OOXML->

Submitted by kazade84
kazade84 (1078337) writes "The BBC reports that we will lose access to data stored in legacy formats as we move to newer standards. The National Archives have made a deal with Microsoft to set up virtual machines running old versions of Windows and Office to access the legacy files to prevent them being lost forever.

The report, although interesting, seems like another marketing attempt by Microsoft to push OOXML as a 'standard' format and makes me wonder why these legacy files aren't just converted to ODF?"

Link to Original Source

In these matters the only certainty is that there is nothing certain. -- Pliny the Elder

Working...