Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

R

Name: Anonymous 2012-11-21 11:32

/prog/, I have a problem which is causing me to over-rustle:

I'm programming/scripting with R, and am trying to do this:

myVariable <- return2Vals(1,2)

I want myVariable to hold the first argument, 1, as its "default value" so if i ever do:

print(myVariable) it'll output 1.

However, I also want it to hold the second argument, 2, somewhat secretively but still accessible.

But I'm not sure how to do this;

would accessing it like:

print(myVariable$secondArgument) //outputs 2

be possible? without compromising the first part (print(myVariable)//outputs 1).

Thanks for taking the time to read this.

Name: Anonymous 2012-11-21 11:38

Never touched R, but wouldn't you need some kind or tuple or pair object on the left hand side? A single variable can't possibly hold two values, surely.

Name: Anonymous 2012-11-21 11:40

Only a Retard would program in R!

Don't change these.
Name: Email:
Entire Thread Thread List