  

Well, you are perfectly right. It is why in can not write the
lessons myself: I have a C++ way of thinking, and I would like to not
transmit it to my student. 

>From the responses I get, it is clear that
there isn't a book that presents such exercises. But I was more hopping
to find my happiness in some kind of "classical exercises sheet" that
teachers write for their student. I myself write 11 exercise sheet for
learning the use of the basic structure and the basic test (lesson 1: R
gui interface; lesson 2: reading a file and data basic structure ;
lesson 3: chi square and t test,...) 

Unfortunately, my exercise's
sheets (on my web site) are about "R test". Does any R teachers have
this kind of exercise sheet, but for "learning R basics"? 

Christophe


> cgenolin, 
> 
> I am worried that your proposed lessons will teach
the wrong message. 
> The goal of good R programming is to think of the
matrix as the unit. 
> Loops are usually the wrong answer. 
> 
> Your
third example should not be taught as a loop. The simplest way to do 
>
that in R is by using the outer function. 
> 
> outer(1:5, 1:5, `>=`) ##
simplest statement 
> 
> ifelse(outer(1:5, 1:5, `>=`), "*", " ") ## get
the '*' in the right place 
> 
> print(ifelse(outer(1:5, 1:5, `>=`),
"*", " "), quote=FALSE) ## suppress the quotation marks 
> Vector,
matrix, and array operations are the important concepts inside a
function. 
> Most base functions work directly on arrays. for example 
>
sin(seq(0,pi, length=9)) 
> 
> The apply family of functions are usually
much clearer than loops. 
> Start with the examples in 
> ?lapply 
> 
>
Rich 
> On Fri, Apr 20, 2012 at 10:05 AM, cgenolin wrote:
> 
>> Thanks
for your answer.
>> 
>> Yes, it is quite different from what I am
looking for which will be more
>> something like :
>> 
>> --- 8<
-----
>> 
>> Exercice 1: wrote a function that compute the surface of a
rectangle
>> 
>> Exercice 2: wrote a function that compute factorial n
(whithout using the
>> function factorial)
>> 
>> Exercice 3: wrote a
function, that given a n, will draw a triangle of "*".
>> Example with
n=5
>> 
>> *
>> **
>> ***
>> ****
>> *****
>> 
>> --- 8< -----
>> 
>>
The first exemple is about writing a (very) simple function and
returning the result ; the second
>> need the use of a loop. The third
will need two loops (for a beginer).
>> 
>> And so on, on various
topic.
>> 
>> Christophe
>> 
>>> Are you familiar with R Inferno? This
is a programming-oriented
>>> tutorial for R by the statistician Patric
Burns. He has generously
>>> placed it as a pdf online for free
(http://www.burns-stat.com/pages/Tutor/R_inferno.pdf [4][4]); you could

>>> 
>>> also
>>> purchase a copy. Of course this will be more than
just a few practice
>>> exercises (a lot more, and actually, I'm not
sure there are any
>>> exercises but you can certainly follow along with
the examples).
>>> Nonetheless, it may still be right up your alley.
There are other
>>> resources for learning the programming side of R,
but only a few that
>>> are as good, and none other free, so far as I
know. If this is really
>>> different from what you're looking for, you
may want to reply with more
>>> detail.
>>> 
>>> Hope that helps.
-Jeff
>>> 
>>> On 4/20/2012 7:41 AM, cgenolin wrote:
>>> 
>>>> Hi the
list, I am looking for some exercices for a PhD student that
>>>> start
to learn R. He already "read" some tutorial, but now he needs
>>>> some
practice. He does *not* need to learn any statistical tools ; he
>>>>
just needs to work on programmation concept. So I am looking for
some
>>>> exercice sheet that will, for example, focus on : -
structuring the
>>>> data (data.frame / list / matrix / ...) - using
controle syntax (for /
>>>> if / while / function) - reading data - ...
Any link for this kind of
>>>> material? Sincerely Christophe
[[alternative HTML version deleted]]
>>>>
_______________________________________________
R-sig-teaching@r-project.org [1] [1] mailing list
>>>>
https://stat.ethz.ch/mailman/listinfo/r-sig-teaching [2] [2] -----
No
>>> virus
>>> 
>>>> found in this message. Checked by AVG -
www.avg.com [3][3] Version: 
>>>> 
>>>> 2012.0.1913 / Virus Database:
2411/4948 - Release Date: 04/20/12
>>> 
>>>
_______________________________________________
>>>
R-sig-teaching@r-project.org [5] [5] mailing list
>>>
https://stat.ethz.ch/mailman/listinfo/r-sig-teaching [6] [6]
>> 
>>
Links:
>> ------
>> [1] mailto:R-sig-teaching@r-project.org [7]
>> [2]
https://stat.ethz.ch/mailman/listinfo/r-sig-teaching [8]
>> [3]
http://www.avg.com [9]
>> [4]
http://www.burns-stat.com/pages/Tutor/R_inferno.pdf [10]
>> [5]
mailto:R-sig-teaching@r-project.org [11]
>> [6]
https://stat.ethz.ch/mailman/listinfo/r-sig-teaching [12] 
>> 
>>
_______________________________________________
>>
R-sig-teaching@r-project.org [13] mailing list
>>
https://stat.ethz.ch/mailman/listinfo/r-sig-teaching [14]

 


Links:
------
[1] mailto:R-sig-teaching@r-project.org
[2]
https://stat.ethz.ch/mailman/listinfo/r-sig-teaching
[3]
http://www.avg.com/
[4]
http://www.burns-stat.com/pages/Tutor/R_inferno.pdf
[5]
mailto:R-sig-teaching@r-project.org
[6]
https://stat.ethz.ch/mailman/listinfo/r-sig-teaching
[7]
mailto:R-sig-teaching@r-project.org
[8]
https://stat.ethz.ch/mailman/listinfo/r-sig-teaching
[9]
http://www.avg.com/
[10]
http://www.burns-stat.com/pages/Tutor/R_inferno.pdf
[11]
mailto:R-sig-teaching@r-project.org
[12]
https://stat.ethz.ch/mailman/listinfo/r-sig-teaching
[13]
mailto:R-sig-teaching@r-project.org
[14]
https://stat.ethz.ch/mailman/listinfo/r-sig-teaching
[15]
mailto:cgenolin@u-paris10.fr

	[[alternative HTML version deleted]]

