-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lesson 2 #3
Comments
For question 4, you're wrong. It does print both things when Your syntax for question 6 is actually fine, with the exception of the |
Thanks, #4 does work just fine, haha! As for #6, I've got:
but it only plots one point, the starting time. I cannot figure out how to get it to loop through all of the times. When I add in |
The clue is in the error: "replacement has length zero". This means your function Take a look at your function |
Thanks! I got it! Please disregard my most recent email/cry for help. I do have a question about the solution I found for #7. I was getting so fed up with my
I first tried |
We've covered all this in the session now, I think. Thanks for getting in touch! |
Thanks again for all your help this morning (well, afternoon for you I suppose). In lesson 4, I'm trying to fix my summary function to use
I don't understand why it's staying that |
You're going to kick yourself about this one - you've not changed the |
Ohhhhhhhhh. I was confused about the usage of
But it actually should be:
I guess I figured that
and it seemed to be working:
Anyway now that I think about it, my issues with
Thanks again. :) |
No! |
Sorry, but I thought you might be online, so I wanted to make a quick comment - no! Go back and read what I wrote again: you're still making the same mistake. Stick with |
uhh, like this?
|
is |
No! You need 10 of those columns. So put the number 10 somewhere else in that function (perhaps replacing the number 1...) |
|
The crowd goes wild! Yes, that's it :D |
Hi Will,
I have a couple questions about Lesson 2:
First is about #4. I've gotten it to work at this point, but it's not as neat as I think it could be. Instead of printing "Good" and "Job" for 5 (the only prime number also divisible by 5) I think the loop just sees the 5 and prints Good, but then it's all happy and doesn't get to the "Job" part of the loop. I fixed this by just creating an extra if statement:
if (i == 5){ cat("Good Job:", i, "\n") }
...but I feel like there must be a better way to accomplish this.
Second question is about #6, plotting a function through time. What I think I need the function to do is loop through the equation for each value of time. I've looked at some other people's code and they seem to be doing this with requesting start/end/by in the function to have the beginning, end, and index for time. Would it be possible to just have something like:
for (i in 1:length(time)){
a * exp(-b * exp(-c * [i]))
}
Also, I'm not sure how to go about looping through a function that has multiple variables, but just recalculating it with one changing variable (in this case time). I've totally guessed at the syntax above.
Thanks,
Sylvia
The text was updated successfully, but these errors were encountered: