[R] First read (was: Re: Looping and paste)

Liviu Andronic landronimirc at gmail.com
Thu Nov 24 13:11:39 CET 2011


On Thu, Nov 24, 2011 at 9:27 AM, Patrick Burns <pburns at pburns.seanet.com> wrote:
> It's very seldom that I disagree with
> Bert, but here is one time.
>
> I don't think "An Introduction to R" is
> a suitable first read for people with
> little computational experience.
>
I must agree with Patrick here. The 'Intro to R' may be appropriate
for someone already versed in statistics and/or programming, but it is
hardly useful as a first read for the neophytes.


> Better (I modestly suggest) would be:
>
> http://www.burns-stat.com/pages/Tutor/hints_R_begin.html
>
To chip in, the first two chapters of Fox and Weisberg (2011) make for
an excellent introduction to R programming. It's gentle, but also
covers many of the difficulties and misunderstandings that one would
encounter in R.

Regards
Liviu




> which includes some other references.
> 'Hints' is imperfect and incomplete but
> it suffers slightly less from the curse of
> knowledge than a lot of other R documentation.
>
> Pat
>
> On 24/11/2011 00:15, Bert Gunter wrote:
>>
>> ... and you can of course do the assignment:
>>
>> Bndy<-  paste (BndY,"to",50+seq_len(BndY), "mN", sep = " ")
>>
>> "An Introduction to R" tells you about such fundamentals and should be
>> a first read for anyone learning R.
>>
>> --- Bert
>>
>> On Wed, Nov 23, 2011 at 4:10 PM, Bert Gunter<bgunter at gene.com>  wrote:
>>>
>>> Don't do this!  paste() is vectorized.
>>>
>>> paste (BndY,"to",50+seq_len(BndY), "mN", sep = " ")
>>>
>>> Cheers,
>>> Bert
>>>
>>> On Wed, Nov 23, 2011 at 3:31 PM, B77S<bps0002 at auburn.edu>  wrote:
>>>>
>>>> out<- vector("list")
>>>> Ylab<- for(i in 1:length(BndY))
>>>> {
>>>> out[i]<- paste(BndY[i]," to ",BndY[i],"mN")
>>>> }
>>>>
>>>> Ylab<- do.call(c, out)
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> markm0705 wrote
>>>>>
>>>>> Dear R helpers
>>>>>
>>>>> I'm trying to make up some labels for plot from this vector
>>>>>
>>>>> BndY<-seq(from = 18900,to= 19700, by = 50)
>>>>>
>>>>> using
>>>>>
>>>>> Ylab<-for(i in BndY) {c((paste(i," to ",i+50,"mN")))}
>>>>>
>>>>> but the vector created is NULL
>>>>>
>>>>> However if i use
>>>>>
>>>>> for(i in BndY) {print(c(paste(i," to ",i+50,"mN")))}
>>>>>
>>>>> I can see the for loop is making the labels I'm looking for but not
>>>>> sure
>>>>> on my error in assigning them to a vector
>>>>>
>>>>> Thanks in advance
>>>>>
>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://r.789695.n4.nabble.com/Looping-and-paste-tp4101892p4102066.html
>>>> Sent from the R help mailing list archive at Nabble.com.
>>>>
>>>> ______________________________________________
>>>> R-help at r-project.org 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.
>>>>
>>>
>>>
>>>
>>> --
>>>
>>> Bert Gunter
>>> Genentech Nonclinical Biostatistics
>>>
>>> Internal Contact Info:
>>> Phone: 467-7374
>>> Website:
>>>
>>> http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm
>>>
>>
>>
>>
>
> --
> Patrick Burns
> pburns at pburns.seanet.com
> twitter: @portfolioprobe
> http://www.portfolioprobe.com/blog
> http://www.burns-stat.com
> (home of 'Some hints for the R beginner'
> and 'The R Inferno')
>
> ______________________________________________
> R-help at r-project.org 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.
>



-- 
Do you know how to read?
http://www.alienetworks.com/srtest.cfm
http://goodies.xfce.org/projects/applications/xfce4-dict#speed-reader
Do you know how to write?
http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail



More information about the R-help mailing list