[R] Finding the median

2012-03-12 Thread elliot.welch
Hi just a quick question in which I must use the "function and return" part of R. If I was asked to define a function called "median" where the function has a single argument x and returns the median value of a vector. How would I go about saying the median = element x in terms of n (say (n + 1

[R] Finding the mean.

2012-03-10 Thread elliot.welch
Using functions how would I go about do this question? (I already have a mean defined for a function of x.) Write a function called MyMean2. This function has two arguments, x and nonzero, where nonzero has the default value TRUE. This function should return the (Previous defined mean of x) i

[R] R

2012-02-19 Thread elliot.welch
Hello, just a couple of short questions that would be much appreciated. Is there a way of putting a vectors inputs in size order from low to high? And if I had a random list or TRUE and FALSE, is there a way of finding the 100th TRUE? Thank you very much, Elliot Welch elliot.we...@virgin.net