Dear Gaja,

Here are a couple suggestions:

1) Read the R posting guide (

http://www.r-project.org/posting-guide.html ). There you will (would

have) find out that A) the R-help list is not for homework questions

and B) you will typically get more help if you show what you have

tried (e.g., your attempts to write the function) and had searched the

R-help archives.

2) Random walks are extremely common, if you search the R-help

archives, you will find several relevant examples. Also, the Internet

is full of example code (plenty using R), that you could read to get

ideas (googling "random walk R code" turned up 426,000 results, with

several on the first page that looked useful).

3) Homework is meant to be a learning exercise for the person to whom

it was assigned, not for experts who already know what to do. Now you

might say, "I am planning on learning from your examples and doing

additional practice", in which case see number 4.

4) I am sure your instructor did not assign this homework unless he or

she already knew how to do it, so if it is okay for you to see and

work off of someone else's example code, then why not talk with your

instructor about getting a sample?

5) Suppose your instructor expects you to do this on your own, but you

would rather have someone else do it for you. You can probably find

someone willing, but then you need to practice how you phrase your

request for help. For example, "I am doing research in ____________

and it uses random walks. I know how to do this in Python (or some

other programming language), but I am having trouble implementing it

in R code, which I want to do because R has the most beautiful graphs

(flattery never hurts when you're asking for a favor). II have this

algorithm (insert some statistical algorithm for how your random walk

will work, possibly directly copied from a HW assignment or other

book). Any suggestions?" If you phrased your question like that, we

could respond with complete solution code, while still feeling good

about ourselves, and not like we'd just helped someone cheat, or

contributed to you not gaining the most possible benefit from your

class (which you are probably paying for), thus, in essence, cheating

you out of your money's value, and the institution out of it's good

name (when you have passed the course but lack the actual knowledge).

So, in summary try (in order):

(re)Reading your lecture note, textbook, or ... and just spending the

time to learn it yourself. Searching the R-help archives (

http://finzi.psych.upenn.edu/search.html ). Searching Google (rule 5

states: "there exists code of it", in this case even in your desired

programming language). Going to your instructor and asking for help

(crazy, I know). Asking us in a way that we can pretend it is not

homework and feel like we are contributing to science (or possibly

small orphaned pets).

Best of luck with whatever option you try (I would particularly love

to see an example of how writing some random walk code for you would

help orphaned pets)

Cheers!

Josh

On Wed, Jan 26, 2011 at 1:06 PM, gaja <

[hidden email]> wrote:

>

> Hello to all again :)

>

> Again, I have an issue with my homework. I was troubling myself for two

> days, and I still can't get it :(

>

> So, if someone can help me, I would be so grateful...

>

>

> HOMEWORK 1.

>

> I need to draw function,

>

> random walk take the length of walk, and its in 2D. As a result, I have to

> take matrix in which are i-lines of matrix, written coordinates on i-steps

>

> radnom.walk <- function (length, dim = 2){

>

> }

>

> HOMEWORK 2

>

> I need to draw function, which draws self-avoiding walk of given length in

> plane level

>

>

> selfavoiding <- function (length)

> {

>

> }

>

> ____________________

>

> That would be all. I'm sure, there is an expert which can help me, hehe. I

> wish to learn with those two examples for other 5, I have to deal with, for

> that homework.

>

> Cheers, Gaja*

> --

> View this message in context:

http://r.789695.n4.nabble.com/Need-help-with-my-homework-tp3238794p3238794.html> Sent from the R help mailing list archive at Nabble.com.

>

> ______________________________________________

>

[hidden email] 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.

>

--

Joshua Wiley

Ph.D. Student, Health Psychology

University of California, Los Angeles

http://www.joshuawiley.com/______________________________________________

[hidden email] mailing list

https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide

http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.