[R-wiki] R Wiki: What do you want me to do now about tips?

Paul Johnson pauljohn32 at gmail.com
Sat Jun 10 04:16:17 CEST 2006


I'm trying to re-tool the script to make a more presentable piece of
html.  I'm down to a place where I am stuck, and it is a simple manner
of handling strings.

There is a vector of strings, some of which are heading/separators
with ==== What ===== and others areh "   tips:..." .  It is called
"cleanedlines" below.

I want a for loop that goes over each item, and if it is a tip, it
should do one thing, but if it is a header, it should do another
thing.

My problem is that I can't figure what kind of "if" statement is
supposed to work to check if it is a tip. I tried "grep" to check, but
it fails. grep on tips returns numeric(0), and the if statement can't
understand that.  To prove I tried, here's some code that does not
work.

for (item in cleanedlines) {
  itsaheading <- grep("====", item, value= F)
  if (1 == itsaheading) {
    reviseditem <- gsub("====","<H2>",item)
    print(reviseditem)
  }else{
     print (item)
  }
}

Throw me a bone! or a tip :)


cleanedlines
[1] "====== R Wiki - Tips ======"
 [2] "==== Data ===="
 [3] "   tips:data-io:aggregate_values|Aggregate values, one for each
line: ''by()''"
 [4] "   tips:data-io:export_table|Export data out of R:
''write.table()'', ''write()'',"
 [5] "   tips:data-io:import_table|Bring raw numbers into R:
''read.table()''"
 [6] "   tips:data-io:ms_windows|Data to/from MS Excel, Access, etc.:
''read.delim()'', ''scan()'', ''RODBC package''"
 [7] "   tips:data-io:spss|Data to/from SPSS: ''read.spss()'',
''write.foreign()'', ''spss.get()''"
 [8] "   tips:data-frames:access_columns|Use subscripting to select
rows/columns"
 [9] "   tips:data-frames:new_aggregate|Create new data frame to hold
aggregate values for each factor"

On 6/9/06, Romain Francois <francoisromain at free.fr> wrote:
> Le 09.06.2006 16:15, Gabor Grothendieck a écrit :
> > I find that your tips page is easier to read
> > than the automatically generated one although
> > that could likely be solved ultimately be improvements
> > to the script.
> >
> > I do find all the various colours somewhat distracting
> > and hard to read on the generated web page.  (this is
> > also true of the rest of the wiki too)
> >
> >
> You sould define a user style sheet like that one (this is firefox, I
> don't know how to do it in other browsers)
>
> @-moz-document url-prefix("http://wiki.r-project.org"){
>   *{color:black !important;}
> }
>
>
>
> > I suggest you maintain your page until the script
> > gets to the point where its comparable in legibility
> > to your hand done one.
> >
> > On 6/9/06, Paul Johnson <pauljohn32 at gmail.com> wrote:
> >
> >> I've just run the alltips program and did generate a big html file.
> >>
> >> http://pj.freefaculty.org/R/alltips.html
> >>
> >> That piece of programming is very amazing to me. How in the heck can a
> >> stat program on my laptop cobble together a web page?  If R had a
> >> function to write a file onto a remote site , this could be completely
> >> automated.
> >>
> >> I could post something like that on a regular basis. That certainly
> >> proves it is possible.
> >>
> >> So far, I've noticed some problems.
> >>
> >> 1. Links inside alltips.html don't work.  They point internally to
> >> places in the Wiki, not to anchors in alltips itself.
> >>
> >> 2. Is there a way to have numbers generated for these tips?  So that
> >> we can refer to them by number?
> >>
> >> 3.   The tips appear without logical sequencing in alltips.html.  I
> >> wish there were a way to designate the placement.  I don't expect
> >> there is a Wiki solution for that, however.
> >>
> >>
> >> In the next week, I will try to learn how to input stuff into the WIki
> >> and I'll also try to make a list of things in Rtips that I think are
> >> most valuable.
> >>
> >> Honestly, some of the tips I have are pretty old or out of date.
> >>
> >>
> >> PJ
> >>
> >> On 6/9/06, Philippe Grosjean <phgrosjean at sciviews.org> wrote:
> >>
> >>> Hello all,
> >>>
> >>> First, I would like to answer to Paul Johnson. The decision to separate
> >>> Rtips into sections and have one page per tip is motivated both by
> >>> technical reasons (already discussed, a wiki is more efficient with
> >>> separate small pages than a big one), and for practical reasons. When
> >>> Rtips remains rather small and managed by one people, like your current
> >>> version of it, it is much easier to handle in one big page. Now, imagine
> >>> that the R Wiki tips section gains popularity and that (just imagine!)
> >>> hundreds of authors write thousands of tips. How would you manage a
> >>> single web page containing these thousands of tips? How do you find tips
> >>> related to, say, handling of data frames, in this big page? How will
> >>> someone with a low-speed Internet connexion get the last tip that he is
> >>> interested in, from this long page (he has to download all the rest first)?
> >>>
> >>> I think that both presentations (several little page versus a single
> >>> large one) have pros and cons. The suggestion to make a digest of the
> >>> tips in the R Wiki, as an alternate presentation, makes much sense in
> >>> this context. Romain François proposed a script for that. A good
> >>> starting basis to automate the creation of that "Rtips digest". Would
> >>> you be happy with this solution?
> >>>
> >>> Regarding the progress made with the R Wiki. This was also a very busy
> >>> time for me. I did my best to finish the Wiki engine for the UseR!2006
> >>> workshop. I still have a couple of aspects to finalize (presentation
> >>> with the sidebar, the Rdconv --wiki is *almost* done, plus a couple of
> >>> other details).
> >>>
> >>> Anyway, whatever where we are now, we should officially launch the R
> >>> Wiki next week at the UseR!2006 workshop. A presentation is planned on
> >>> thursday (see
> >>> http://www.r-project.org/useR-2006/Abstracts/Grosjean.pdf). It would be
> >>> also an occasion to recruit other volunteers to help in migrating
> >>> material to the Wiki. I think that the priority is to write some initial
> >>> material for the empty sections, like "getting-started:what-is-r",
> >>> "getting-started:faq" (this is rather easy: it is the wiki version of
> >>> the various official FAQ documents, but with the possibility to append
> >>> comments for the wiki users), "getting-started:case-studies",
> >>> "guides:books". Another priority is to migrate material from the first R
> >>> Wiki by Detlef Steuer.
> >>>
> >>> Thank you to all wiki authors or "migrators". The progress is slower
> >>> than expected, but we have already achieved a pretty good result, I think.
> >>>
> >>> Best,
> >>>
> >>> Philippe
> >>>
> >>> ..............................................<°}))><........
> >>>   ) ) ) ) )
> >>> ( ( ( ( (    Prof. Philippe Grosjean
> >>>   ) ) ) ) )
> >>> ( ( ( ( (    Numerical Ecology of Aquatic Systems
> >>>   ) ) ) ) )   Mons-Hainaut University, Pentagone (3D08)
> >>> ( ( ( ( (    Academie Universitaire Wallonie-Bruxelles
> >>>   ) ) ) ) )   8, av du Champ de Mars, 7000 Mons, Belgium
> >>> ( ( ( ( (
> >>>   ) ) ) ) )   phone: + 32.65.37.34.97, fax: + 32.65.37.30.54
> >>> ( ( ( ( (    email: Philippe.Grosjean at umh.ac.be
> >>>   ) ) ) ) )
> >>> ( ( ( ( (    web:   http://www.umh.ac.be/~econum
> >>>   ) ) ) ) )          http://www.sciviews.org
> >>> ( ( ( ( (
> >>> ..............................................................
> >>>
> >>> Nick Drew wrote:
> >>>
> >>>> Like others, I've been busy and not made the kind of progress
> >>>> of converting Rtips to the R Wiki that I've wanted to. I had hoped to have
> >>>> section 1 (Data input/output) done by now, but there is still
> >>>> 1.5 - 1.7 left on that section.
> >>>>
> >>>> I'm willing to continue to help with this. I will finish section 1
> >>>> by  the end of next week. However, I don't see me making
> >>>> much progress during our warm summer months here in Oregon.
> >>>>
> >>>> Perhaps we could generate a list of which sections of
> >>>> Rtips have been converted. Then others would know where to
> >>>> continue if they desire.
> >>>>
> >>>> ~Nick
> >>>>
> >>>> -----Original Message-----
> >>>> From: r-sig-wiki-bounces at r-project.org
> >>>> [mailto:r-sig-wiki-bounces at r-project.org]On Behalf Of Ben Bolker
> >>>> Sent: Friday, June 09, 2006 4:02 AM
> >>>> To: Paul Johnson
> >>>> Cc: r-sig-wiki at r-project.org
> >>>> Subject: Re: [R-wiki] R Wiki: What do you want me to do now about tips?
> >>>>
> >>>>
> >>>>    Having seen no answer thus far:
> >>>>
> >>>>     Parts but not all of Rtips have been migrated to the R wiki
> >>>> (I'd make a wild guess of about 30-50%.)  My personal preference
> >>>> would be migration.  Apparently DocuWiki doesn't have a "single
> >>>> page" view, but there was some discussion on the list about how
> >>>> to run a script etc. to take a snapshot -- see the April archives
> >>>> and Romain Francois' code at
> >>>> http://wiki.r-project.org/rwiki/doku.php?id=tips:misc:alltips .
> >>>> If you were willing (once the migration is complete) to run
> >>>> this as a script on your server (say daily) and post the results ...
> >>>>
> >>>>     Work on the Wiki has slowed down once again (perhaps inevitable
> >>>> since so many people are busy).  I'd really like to encourage
> >>>> list-readers to keep at it -- would people be willing to make
> >>>> some kind of nominal deadline for at least getting the rest
> >>>> of R-tips moved over/volunteer for sections?
> >>>>
> >>>>    cheers
> >>>>      Ben Bolker
> >>>>
> >>>>
> >>>> Paul Johnson wrote:
> >>>>
> >>>>
> >>>>> I have this gmail account but can't manage it very well.  Too many
> >>>>> messages, too many lists, blah, blah...
> >>>>>
> >>>>> Anyway, I just noticed several messages in this list debating the
> >>>>> question of whether I should maintain Rtips or try to migrate the rest
> >>>>> of the content into the R Wiki.  What is that status now?
> >>>>>
> >>>>> My opinion is that some of the things in Rtips are quite seriously
> >>>>> useful, especially "how to save graphs" and "use predict with
> >>>>> regression" but many of the things are tidbits that I accumulated for
> >>>>> one use and never used again.
> >>>>>
> >>>>> I do think it is good if users can just view all the tips on a single
> >>>>> page, as some readers suggested.  The one who said I should keep
> >>>>> separate content on Rtips seemed to think the big drawback of the Wiki
> >>>>> was the sub-compartmentlization of information into little pages, and
> >>>>> there is some truth in that.  But I've seen other Wiki programs that
> >>>>> could just display all content in a single www post.
> >>>>>
> >>>>> I'm sorry I've not been paying attention, but now it is summer and I
> >>>>> have some time while preparing to teach stats again in the fall, and
> >>>>> so if you (all) tell me what needs to be done, I will do it.
> >>>>>
> >>>>>
> >>>> _______________________________________________
> >>>> R-sig-wiki mailing list
> >>>> R-sig-wiki at r-project.org
> >>>> https://stat.ethz.ch/mailman/listinfo/r-sig-wiki
> >>>>
> >>>> _______________________________________________
> >>>> R-sig-wiki mailing list
> >>>> R-sig-wiki at r-project.org
> >>>> https://stat.ethz.ch/mailman/listinfo/r-sig-wiki
> >>>>
> >>>>
> >>>>
> >>>
> >> --
> >> Paul E. Johnson
> >> Professor, Political Science
> >> 1541 Lilac Lane, Room 504
> >> University of Kansas
> >>
> >> _______________________________________________
> >> R-sig-wiki mailing list
> >> R-sig-wiki at r-project.org
> >> https://stat.ethz.ch/mailman/listinfo/r-sig-wiki
> >>
> >>
> >
> > _______________________________________________
> > R-sig-wiki mailing list
> > R-sig-wiki at r-project.org
> > https://stat.ethz.ch/mailman/listinfo/r-sig-wiki
> >
> >
> >
>
>
> --
> visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
> mixmod 1.7 is released : http://www-math.univ-fcomte.fr/mixmod/index.php
> +---------------------------------------------------------------+
> | Romain FRANCOIS - http://francoisromain.free.fr               |
> | Doctorant INRIA Futurs / EDF                                  |
> +---------------------------------------------------------------+
>
> _______________________________________________
> R-sig-wiki mailing list
> R-sig-wiki at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-wiki
>


-- 
Paul E. Johnson
Professor, Political Science
1541 Lilac Lane, Room 504
University of Kansas



More information about the R-sig-wiki mailing list