[R] Partial comparison in string vector

Steve Powell steve at promente.org
Tue Aug 21 11:32:05 CEST 2007


Hi list members

I have a vector of strings
x=c("w","ex","ee")
And I want to get a logical vector showing the positions where my search
string "e" matches the elements partially, i.e. is at least the left-hand
part of the target strings, i.e. I want to get a vector FALSE TRUE TRUE.

Any ideas?
Thanks 
Steve Powell

 
proMENTE social research 
research | evaluation | training & consulting 
Kranjčevićeva 35, 71000 Sarajevo 
mobile: +387 61 215 997 | office: +387 33 556 865 | fax: +387 33 556 866
skype: stevepowell99 
www.promente.org  |  www.mojakarijera.com  |  www.psih.org  

-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of
r-help-request at stat.math.ethz.ch
Sent: 20 August 2007 12:00
To: r-help at stat.math.ethz.ch
Subject: R-help Digest, Vol 54, Issue 20

Send R-help mailing list submissions to
	r-help at stat.math.ethz.ch

To subscribe or unsubscribe via the World Wide Web, visit
	https://stat.ethz.ch/mailman/listinfo/r-help
or, via email, send a message with subject or body 'help' to
	r-help-request at stat.math.ethz.ch

You can reach the person managing the list at
	r-help-owner at stat.math.ethz.ch

When replying, please edit your Subject line so it is more specific
than "Re: Contents of R-help digest..."


Today's Topics:

   1.  recommended combo of apps for new user? (Antony Unwin)
   2. Re: Does anyone else think this might be worth a warning?!?
      (Adaikalavan Ramasamy)
   3. can't find "as.family" function (Mario Alfonso Morales Rivera)
   4. Re: can't find "as.family" function (Prof Brian Ripley)
   5. Re: Problem with lsa package (data.frame) on Windows XP
      (Uwe Ligges)
   6. Re: recommended combo of apps for new user? (Gabor Grothendieck)
   7. Re: Regulatory Compliance and Validation Issues (Thomas Lumley)
   8. Re: Question about lme and AR(1) (Thomas Lumley)
   9. Re: recommended combo of apps for new user? (Martin Brown)
  10. Re: recommended combo of apps for new user? (Martin Brown)
  11. Re: recommended combo of apps for new user? (hadley wickham)
  12. Prerequisite for running RWeka (adschai at optonline.net)
  13. Question on R server and TinnR (adschai at optonline.net)
  14. Re: Prerequisite for running RWeka (Prof Brian Ripley)
  15. Creating a data set within a function (Anup Nandialath)
  16. Re: Creating a data set within a function (Gabor Grothendieck)
  17. How to parse a string into the symbol for a data frame object
      (Darren Weber)
  18. Re: How to parse a string into the symbol for a data frame
      object (jim holtman)
  19. Error bars using data from bugs() (Matthew Krachey)
  20. Re: How to parse a string into the symbol for a data frame
      object (Gabor Grothendieck)
  21. how to collapse a list of 1 column matrix to a matrix?
      (adschai at optonline.net)
  22. Re: how to collapse a list of 1 column matrix to a matrix?
      (Fran?ois Pinard)
  23. Re: how to collapse a list of 1 column matrix to a matrix?
      (adschai at optonline.net)
  24. Re: how to collapse a list of 1 column matrix to a matrix?
      (Gabor Grothendieck)
  25. Re: Rcmdr window border lost (John Fox)
  26. Re: how to collapse a list of 1 column matrix to a matrix?
      (adschai at optonline.net)
  27. Re: SEM for categorical data (John Fox)
  28. Re: how to collapse a list of 1 column matrix to a matrix?
      (Jared O'Connell)
  29. Re: SEM for categorical data (A. Beaujean)
  30. Re: Does anyone else think this might be worth a warning?!?
      (Felix Andrews)
  31. Re: how to collapse a list of 1 column matrix to a matrix?
      (Fran?ois Pinard)
  32. Re: how to collapse a list of 1 column matrix to a matrix?
      (adschai at optonline.net)
  33. Building Packages with AnnBuilder (jakob bleier)
  34. Differentiation (Shubha Vishwanath Karanth)
  35. Labelling certain points on the x-axis (squall44)
  36. Re: Restricted VAR parameter estimation (Pfaff, Bernhard Dr.)
  37. Re: Differentiation (Uwe Ligges)
  38. Question about writing some code (squall44)
  39. Re: Building Packages with AnnBuilder (Georg Otto)
  40. Q:   combine 2 data frames with missing values (Tom Willems)
  41. Re: Differentiation (nalluri pratap)
  42. Re: Labelling certain points on the x-axis (Uwe Ligges)
  43. Re: Question about writing some code (Uwe Ligges)
  44. Re: Differentiation (Paul Smith)


----------------------------------------------------------------------

Message: 1
Date: Sun, 19 Aug 2007 12:24:31 +0200
From: Antony Unwin <unwin at math.uni-augsburg.de>
Subject: [R]  recommended combo of apps for new user?
To: r-help at stat.math.ethz.ch, "Martin Brown" <mjb2000 at gmail.com>
Message-ID:
	<8AE33254-2538-4892-84DE-2EA67BDE05DB at math.uni-augsburg.de>
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed

> In fact a lot of my work involves exploratory and
> descriptive analyses of rather large and messy databases from  
> ecological
> monitoring, rather than statistical tests per se.

For the exploratory part of your work you should consider the iPlots  
package, which provides interactive graphics for R.

Antony Unwin



------------------------------

Message: 2
Date: Sun, 19 Aug 2007 13:48:45 +0100
From: Adaikalavan Ramasamy <ramasamy at cancer.org.uk>
Subject: Re: [R] Does anyone else think this might be worth a
	warning?!?
To: Matthew Walker <m.g.walker at massey.ac.nz>
Cc: r-help at stat.math.ethz.ch
Message-ID: <46C83C2D.6050804 at cancer.org.uk>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

First, note that functions in R match named arguments first, followed by 
the position of the arguments in the call.

Second, have a look at how mean and max are defined

    mean <- function (x, trim = 0, na.rm = FALSE, ...){

    max <- function (..., na.rm = FALSE){

It's the difference in the position of "..." argument or catchall 
argument (sorry, I don't know its formal name) that determines the 
different behaviour. The "..." is often converted to a list internally.

So when you type in mean(1,1,2), it is treated as
  "mean( x=1, trim=1, na.rm=2 )".

and when you type in max(1,1,2), it is treated as
  "max( as.list(1,1,2), na.rm = FALSE )"


However, you do raise a good point. Reading mean.default(), I do not see 
how and when the "..." argument in mean() comes to play. Perhaps 
redefine mean to be mean <- function (..., trim = 0, na.rm = FALSE) so 
that it is similar to max, sum, range etc.

But there might be a philosopphical counter argument for this as well. 
Functions like mean() and sd() are supposed to summarise a single vector 
whereas max, sum, range can work on several vectors by concatenating 
them into a single list. Consider max( c(1,2,3), c(2,3,4) ).

Regards, Adai



Matthew Walker wrote:
> Hi,
> 
> I was *very* surprised by this little trick for new players: mean() only 
> considers its first argument!
> 
>  > mean(1,1,2)
> [1] 1
>  > mean(2,1,1)
> [1] 2
> 
> 
> I found this very different behaviour to max():
> 
>  > max(1,1,2)
> [1] 2
>  > max(2,1,1)
> [1] 2
> 
> 
> 
> Perhaps this is the wrong list to ask, but does anyone else think this a 
> little on the interesting side?  Is it not possible to detect a first 
> argument of length one in the presence of other un-named arguments and 
> at least produce a warning?
> 
> 
> Cheers,
> 
> 
> Matthew
> 
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
> 
> 
>



------------------------------

Message: 3
Date: Sun, 19 Aug 2007 08:06:46 -0500
From: Mario Alfonso Morales Rivera <malfonso at sinu.unicordoba.edu.co>
Subject: [R] can't find "as.family" function
To: r-help at stat.math.ethz.ch
Message-ID: <46C84066.6040108 at sinu.unicordoba.edu.co>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Hi R users, 

I want to use dglm Package.

I run the examples and it give me an error:



Error en dglm(lot1 ~ log(u), ~1, data = clotting, family = Gamma) :
        no se pudo encontrar la funci?n "as.family"



dglm can't find "as.family" function


why ?


Thank you for your help



------------------------------

Message: 4
Date: Sun, 19 Aug 2007 16:00:36 +0100 (BST)
From: Prof Brian Ripley <ripley at stats.ox.ac.uk>
Subject: Re: [R] can't find "as.family" function
To: Mario Alfonso Morales Rivera <malfonso at sinu.unicordoba.edu.co>
Cc: r-help at stat.math.ethz.ch
Message-ID: <Pine.LNX.4.64.0708191547000.7841 at gannet.stats.ox.ac.uk>
Content-Type: text/plain; charset="iso-8859-1"

On Sun, 19 Aug 2007, Mario Alfonso Morales Rivera wrote:

> Hi R users,
>
> I want to use dglm Package.
> I run the examples and it give me an error:
>
> Error en dglm(lot1 ~ log(u), ~1, data = clotting, family = Gamma) :
>        no se pudo encontrar la funci?n "as.family"
>
> dglm can't find "as.family" function
>
> why ?

Because it does not exist in R (nor in the current version of package 
dglm).

> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

Please do as we ask.  We asked for the output of sessionInfo(), and one 
guess is that your versions are not current and this is a problem that has 
already been solved: another is that you have attached a package that 
conflicts with dglm -- the information we asked for would have helped in 
both cases.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

------------------------------

Message: 5
Date: Sun, 19 Aug 2007 17:45:20 +0200
From: Uwe Ligges <ligges at statistik.uni-dortmund.de>
Subject: Re: [R] Problem with lsa package (data.frame) on Windows XP
To: Walter Rojas <walterrojas at mac.com>
Cc: r-help at stat.math.ethz.ch
Message-ID: <46C86590.8020908 at statistik.uni-dortmund.de>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Please specify reproducible examples, it is almost impossible to help 
otherwise. Also, please provide all error messages and a traceback(). 
Please tell us versions of R and versions of the packages you are using.
If you are sure this is an error in the package, please send that 
reproducible example to the package maintainer.

Uwe Ligges


Walter Rojas wrote:
> Dear R team,
> 
> The following piece of code (to use the lsa package) works fine on my  
> mac os x, but when I run the same code on Windows XP, it doesn't work  
> any more.
> 
> ### code:
> library("lsa")
> matrix1 = textmatrix("C:\\Documents and Settings\\tine stalmans.TINE. 
> 000\\LSA\\cuentos\\", stemming=TRUE, language="spanish",  
> minWordLength=2, minDocFreq=1, stopwords=NULL, vocabulary=NULL)
> print(matrix1,bag_lines = 3, bag_cols = 3)
> matrix1 = lw_bintf(matrix1) * gw_idf(matrix1)
> space = lsa(matrix1, dims = dimcalc_share())
> as.textmatrix(space)
> 
> ### the following line fails on windows XP
> matrix2 = textmatrix("C:\\Documents and Settings\\tine stalmans.TINE. 
> 000\\LSA\\respuestas\\", stemming=TRUE, language="spanish",  
> minWordLength=2, minDocFreq=1, stopwords=NULL,vocabulary=rownames 
> (matrix1))
> matrix2 = lw_bintf(matrix2)
> matrix2fld = fold_in(matrix2, space)
> r <- cor(matrix2fld[,"respId1.txt"], matrix2fld[,"respAl1.txt"],  
> method = "pearson")
> print(r)
> 
> 
> An error occurs when creating the second textmatrix with the  
> vocabulary of the first. The error I get is:
> 
> in data.frame(docs = basename(file), terms = names(tab), Freq = tab,  :
>          arguments imply differing number of rows: 1, 0
> 
> When I change the vocabulary argument to NULL, it doesn't report this  
> error any more; however, then the code will fail on the fold_in  
> method further down.
> 
> I found another user who reported this same problem on-line; however,  
> I didn't find any answers.
> 
> Thank you very much in advance for your reply.
> Tine.
> 
> ______________________________________________
> R-help at stat.math.ethz.ch 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.



------------------------------

Message: 6
Date: Sun, 19 Aug 2007 11:46:00 -0400
From: "Gabor Grothendieck" <ggrothendieck at gmail.com>
Subject: Re: [R] recommended combo of apps for new user?
To: r-help at stat.math.ethz.ch
Message-ID:
	<971536df0708190846n6a049393m6f881dab2799c8b at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Regarding RODBC vs. DBI-based packages (RSQLite, RMySQL, etc.) its
my perception, possibly mistaken, that apart from any consideration of
the R packages themselves, ODBC (which originated in the Windows world)
is more widely used on Windows than UNIX.  Also ODBC has the problem
that one must configure it which puts an extra step into the process.  Clear
documentation on how to do such ODBC configuration may be difficult to find.

On the other hand the RODBC package itself seems to be maintained
very well and is typically available for new versions of R before the
DBI-based packages.

On 8/19/07, Prof Brian Ripley <ripley at stats.ox.ac.uk> wrote:
> Some additional comments on the DBMS front.
>
> (a) SPSS is not a DBMS, so it is not clear that you need this. But if you
> do and are storing valuable data in a DBMS a lot of further questions come
> into play, like how you are going to do backups.  I'd say PostgreSQL was
> really only for professional-level administrators.  My sysadmins recommend
> MySQL for most people.  We do also run PostgreSQL and they find it a lot
> trickier to maintain.
>
> 'dozens of columns and thousands of rows' is not big.  A data frame with
> 50 columns and 5000 rows would only take 2Mb to store, and R will easily
> handle 100x with 4GB of RAM (and if you have less, get 4GB).  So storing
> data in .rda (R's save() format) is most likely viable.  R's indexing etc
> operations make it good at data manipulation, and using a DBMS will
> involve learning SQL, a non-trivial cost.
>
> (b) You have a choice of interfaces to a DBMS, RODBC and the DBI+ family,
> e.g. DBI+RMySQL and DBI+RSQLite.  I'm biased, but I find RODBC more
> intuitive, and many people have reported it to be faster.  If all you want
> is non-permanent storage for manipulation of large data sets, consider
> also SQLiteDF.
>
> On Sat, 18 Aug 2007, Duncan Murdoch wrote:
>
> > Martin Brown wrote:
> >> [i sent this message earlier but apparently should have sent it plain
> >> text, as follows..]
> >>
> >> Hi there,
> >>
> >> I would like some advice, not so much about how to use R, but about
> >> software that I need to complement R.  I've rooted around in the FAQ's
> >> and done a few searches on this mailing list but haven't quite found
> >> the perspective I need.
> >>
> >> I am an experienced data analyst in my field (forest ecology and
> >> ecological monitoring) but new to R. I am a long time user of SPSS and
> >> have gotten pretty handy with it.  However, I am frustrated with SPSS
> >> for several reasons:  There's the cost (I'm a freelancer; I pay for my
> >> software myself);  the Windows dependence (I use Kubuntu as my usual
> >> OS now, and switching back and forth is a pain); the horrible
> >> inefficiency when I do certain types of file manipulations; and the
> >> inability to do the kind of publication-quality graphs I want... I've
> >> usually ended up using a commercial graphing program (another source
> >> of expense and limitation).
> >>
> >> I'd like to switch to using R on Kubuntu, for all those reasons.  In
> >> addition I think the mathematical formality that R encourages might be
> >> good for me.
> >>
> >> However, reviewing the FAQ's on the R project web site makes me
> >> realize that I've been using SPSS as three kinds of software really:
> >> a DBMS; a statistical analysis package; and a graphing package.  It
> >> looks like moving to R might involve learning three kinds of software,
> >> not just one.  I wonder:
> >>
> >> 1) What open-source DBMS works most seamlessly with R?  I have seen
> >> MySQL recommended but wonder if there are alternatives.  I sometimes
> >> need to handle big data files.  In fact a lot of my work involves
> >> exploratory and descriptive analyses of rather large and messy
> >> databases from ecological monitoring, rather than statistical tests
> >> per se.  In SPSS the data files I have been generating have dozens of
> >> columns and thousands of rows, often with value and variable labels
> >> helpful for documenting my work.
>
> See above.
>
> >
> > I think you won't find much difference in the R interface between MySQL,
> > PostgreSQL, or SQLite.  The choice should be made based on the qualities
> > of the database (and I don't know enough about the differences to give a
> > recommendaton.)
> >> 2) For the purpose of creating publication-quality graphs, do R users
> >> typically need to go outside of the R system? If so, what open-source
> >> programs would you all recommend?
> >>
> > R is great for this, but you might need to go outside for some
> > specialized stuff (e.g. medical imaging).
> >
> >> 3) Any other software I need to learn that would make my work in R
> >> more productive? (for example, a code editor).
> >
> > A lot of people are happy with ESS mode in Emacs.
> >
> > Duncan Murdoch
> >
> > ______________________________________________
> > R-help at stat.math.ethz.ch 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.
> >
>
> --
> Brian D. Ripley,                  ripley at stats.ox.ac.uk
> Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
> University of Oxford,             Tel:  +44 1865 272861 (self)
> 1 South Parks Road,                     +44 1865 272866 (PA)
> Oxford OX1 3TG, UK                Fax:  +44 1865 272595
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>



------------------------------

Message: 7
Date: Sun, 19 Aug 2007 08:50:17 -0700 (PDT)
From: Thomas Lumley <tlumley at u.washington.edu>
Subject: Re: [R] Regulatory Compliance and Validation Issues
To: Cody Hamilton <Cody_Hamilton at Edwards.com>
Cc: "r-help at stat.math.ethz.ch" <r-help at stat.math.ethz.ch>
Message-ID:
	<Pine.LNX.4.64.0708190839120.18307 at homer24.u.washington.edu>
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed

On Fri, 17 Aug 2007, Cody Hamilton wrote:

<snip>
> I have a few specific comments/questions that I would like to present to 
> the R help list.
<snip>
> 2. While the document's scope is limited to base R plus recommended 
> packages, I believe most companies will need access to functionalities 
> provided by packages not included in the base or recommended packages. 
> (For example, I don't think I could survive without the sas.get() 
> function from the Design library.)  How can a company address the issues 
> covered in the document for packages outside its scope?  For example, 
> what if a package's author does not maintain historical archive versions 
> of the package?  What if the author no longer maintains the package? 
> Is the solution to add more packages to the recommended list (I'm fairly 
> certain that this would not be a simple process) or is there another 
> solution?

This will have to be taken up with the package maintainer.  The R 
Foundation doesn't have any definitive knowledge about, eg, Frank 
Harrell's development practices and I don't think the FDA would regard our 
opinions as relevant.

Archiving, at least, is addressed by CRAN: all the previously released 
versions of packages are available

> 3. At least at my company, each new version must undergo basically the 
> same IQ/OQ/PQ as the first installation.  As new versions of R seem to 
> come at least once a year, the ongoing validation effort would be 
> painful if the most up-to-date version of R is to be maintained within 
> the company.  Is there any danger it delaying the updates (say updating 
> R within the company every two years or so)?

It's worse than that: there are typically 4 releases of R per year (the 
document you are commenting on actually gives dates).  The ongoing 
validation effort may indeed be painful, and this was mentioned as an 
issue in the talk by David James & Tony Rossini.

The question of what is missed by delaying updates can be answered by 
looking at the NEWS file. The question of whether it is dangerous is 
really an internal risk management issue for you.

 	-thomas



------------------------------

Message: 8
Date: Sun, 19 Aug 2007 08:55:03 -0700 (PDT)
From: Thomas Lumley <tlumley at u.washington.edu>
Subject: Re: [R] Question about lme and AR(1)
To: Francisco Redelico <redelico_f at yahoo.com.ar>
Cc: r-help at stat.math.ethz.ch
Message-ID:
	<Pine.LNX.4.64.0708190850220.18307 at homer24.u.washington.edu>
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed

On Sat, 18 Aug 2007, Francisco Redelico wrote:

> Dear R users,
>
>
> As far as I know, EM algorithm can be only applied to estimate parameter 
> from a regular exponential family.

No. The EM algorithm will converge to a stationary point (and except in 
artificial cases, to a local maximum) for any likelihood.

The special case you may be thinking of is that in some problems the 
E-step is equivalent to computing E[missing data | observed data] rather 
than the more general E[loglikelihood|observed data]

 	-thomas

Thomas Lumley			Assoc. Professor, Biostatistics
tlumley at u.washington.edu	University of Washington, Seattle



------------------------------

Message: 9
Date: Sun, 19 Aug 2007 09:20:29 -0700
From: "Martin Brown" <mjb2000 at gmail.com>
Subject: Re: [R] recommended combo of apps for new user?
To: r-help at stat.math.ethz.ch
Message-ID:
	<1001ded40708190920m5e9634dexbe20696e93c6112f at mail.gmail.com>
Content-Type: text/plain

Thanks so much for the many responses on and off this email list!

I think it's helped me reach a resolution.  I'm going to use R on my current
small project for something relatively self-contained, such as some final
tests and graphics. I figure this will help me learn some basics about
interacting with R without getting too bogged down in setting up a new
database system -- which sounds like a job all on its own.  After I
understand a bit more about R's capabilities I'll ease into the database
part.

Cheers, Martin


On 8/19/07, Gabor Grothendieck <ggrothendieck at gmail.com> wrote:
>
> Regarding RODBC vs. DBI-based packages (RSQLite, RMySQL, etc.) its
> my perception, possibly mistaken, that apart from any consideration of
> the R packages themselves, ODBC (which originated in the Windows world)
> is more widely used on Windows than UNIX.  Also ODBC has the problem
> that one must configure it which puts an extra step into the
> process.  Clear
> documentation on how to do such ODBC configuration may be difficult to
> find.
>
> On the other hand the RODBC package itself seems to be maintained
> very well and is typically available for new versions of R before the
> DBI-based packages.
>
> On 8/19/07, Prof Brian Ripley <ripley at stats.ox.ac.uk> wrote:
> > Some additional comments on the DBMS front.
> >
> > (a) SPSS is not a DBMS, so it is not clear that you need this. But if
> you
> > do and are storing valuable data in a DBMS a lot of further questions
> come
> > into play, like how you are going to do backups.  I'd say PostgreSQL was
> > really only for professional-level administrators.  My sysadmins
> recommend
> > MySQL for most people.  We do also run PostgreSQL and they find it a lot
> > trickier to maintain.
> >
> > 'dozens of columns and thousands of rows' is not big.  A data frame with
> > 50 columns and 5000 rows would only take 2Mb to store, and R will easily
> > handle 100x with 4GB of RAM (and if you have less, get 4GB).  So storing
> > data in .rda (R's save() format) is most likely viable.  R's indexing
> etc
> > operations make it good at data manipulation, and using a DBMS will
> > involve learning SQL, a non-trivial cost.
> >
> > (b) You have a choice of interfaces to a DBMS, RODBC and the DBI+
> family,
> > e.g. DBI+RMySQL and DBI+RSQLite.  I'm biased, but I find RODBC more
> > intuitive, and many people have reported it to be faster.  If all you
> want
> > is non-permanent storage for manipulation of large data sets, consider
> > also SQLiteDF.
> >
> > On Sat, 18 Aug 2007, Duncan Murdoch wrote:
> >
> > > Martin Brown wrote:
> > >> [i sent this message earlier but apparently should have sent it plain
> > >> text, as follows..]
> > >>
> > >> Hi there,
> > >>
> > >> I would like some advice, not so much about how to use R, but about
> > >> software that I need to complement R.  I've rooted around in the
> FAQ's
> > >> and done a few searches on this mailing list but haven't quite found
> > >> the perspective I need.
> > >>
> > >> I am an experienced data analyst in my field (forest ecology and
> > >> ecological monitoring) but new to R. I am a long time user of SPSS
> and
> > >> have gotten pretty handy with it.  However, I am frustrated with SPSS
> > >> for several reasons:  There's the cost (I'm a freelancer; I pay for
> my
> > >> software myself);  the Windows dependence (I use Kubuntu as my usual
> > >> OS now, and switching back and forth is a pain); the horrible
> > >> inefficiency when I do certain types of file manipulations; and the
> > >> inability to do the kind of publication-quality graphs I want... I've
> > >> usually ended up using a commercial graphing program (another source
> > >> of expense and limitation).
> > >>
> > >> I'd like to switch to using R on Kubuntu, for all those reasons.  In
> > >> addition I think the mathematical formality that R encourages might
> be
> > >> good for me.
> > >>
> > >> However, reviewing the FAQ's on the R project web site makes me
> > >> realize that I've been using SPSS as three kinds of software really:
> > >> a DBMS; a statistical analysis package; and a graphing package.  It
> > >> looks like moving to R might involve learning three kinds of
> software,
> > >> not just one.  I wonder:
> > >>
> > >> 1) What open-source DBMS works most seamlessly with R?  I have seen
> > >> MySQL recommended but wonder if there are alternatives.  I sometimes
> > >> need to handle big data files.  In fact a lot of my work involves
> > >> exploratory and descriptive analyses of rather large and messy
> > >> databases from ecological monitoring, rather than statistical tests
> > >> per se.  In SPSS the data files I have been generating have dozens of
> > >> columns and thousands of rows, often with value and variable labels
> > >> helpful for documenting my work.
> >
> > See above.
> >
> > >
> > > I think you won't find much difference in the R interface between
> MySQL,
> > > PostgreSQL, or SQLite.  The choice should be made based on the
> qualities
> > > of the database (and I don't know enough about the differences to give
> a
> > > recommendaton.)
> > >> 2) For the purpose of creating publication-quality graphs, do R users
> > >> typically need to go outside of the R system? If so, what open-source
> > >> programs would you all recommend?
> > >>
> > > R is great for this, but you might need to go outside for some
> > > specialized stuff (e.g. medical imaging).
> > >
> > >> 3) Any other software I need to learn that would make my work in R
> > >> more productive? (for example, a code editor).
> > >
> > > A lot of people are happy with ESS mode in Emacs.
> > >
> > > Duncan Murdoch
> > >
> > > ______________________________________________
> > > R-help at stat.math.ethz.ch 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.
> > >
> >
> > --
> > Brian D. Ripley,                  ripley at stats.ox.ac.uk
> > Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
> > University of Oxford,             Tel:  +44 1865 272861 (self)
> > 1 South Parks Road,                     +44 1865 272866 (PA)
> > Oxford OX1 3TG, UK                Fax:  +44 1865 272595
> >
> > ______________________________________________
> > R-help at stat.math.ethz.ch 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.
> >
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>

	[[alternative HTML version deleted]]



------------------------------

Message: 10
Date: Sun, 19 Aug 2007 09:24:55 -0700
From: "Martin Brown" <mjb2000 at gmail.com>
Subject: Re: [R] recommended combo of apps for new user?
To: r-help at stat.math.ethz.ch
Message-ID:
	<1001ded40708190924u72b3e9far6c5643a9d69809 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Thanks so much for the many responses on and off this email list!

I think it's helped me reach a resolution.  I'm going to use R on my
current small project for something relatively self-contained, such as
some final tests and graphics. I figure this will help me learn some
basics about interacting with R without getting too bogged down in
setting up a new database system -- which sounds like a job all on its
own.  After I understand a bit more about R's capabilities I'll ease
into the database part.

Cheers, Martin



------------------------------

Message: 11
Date: Sun, 19 Aug 2007 13:26:12 -0500
From: "hadley wickham" <h.wickham at gmail.com>
Subject: Re: [R] recommended combo of apps for new user?
To: "John Kane" <jrkrideau at yahoo.ca>
Cc: r-help at stat.math.ethz.ch
Message-ID:
	<f8e6ff050708191126g622c0d6cnc52bea2c8db3e575 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

On 8/18/07, John Kane <jrkrideau at yahoo.ca> wrote:
> I'm just starting to get a grasp on how R works so
> don't take my words too seriously but have a look at
> http://addictedtor.free.fr/graphiques/ for some idea
> of what R can do for publication quality graphics.  It
> is always possible that you might need another
> graphics package as well but I think it unlikely.

I may be in the minority, but I really don't like the R graph gallery.
 To my eye it largely provides examples of what you _shouldn't_ do
with graphics (and also seems rather unloved at the moment, given the
large number of spam keywords).  It fails to provide examples of using
graphics to gain insight into your data and mainly focuses on drawing
pretty (ugly) pictures.

Unfortunately there aren't many better resources at the moment.
Deepayan Sarkar is working on a lattice book, and hopefully he will
make the plots available on his website as well.  I'm also working on
a book for my ggplot2 package (http://had.co.nz/ggplot2) but that
won't be finished until next year.  For interactive graphics, the
GGobi book (http://www.ggobi.org/book/) is very close to being
published, and provides details about the R-GGobi link as well as many
techniques for gaining insight into your data interactively.  Another
option is the Graphics of Large Dataset book (http://rosuda.org/gold/)
which provides a wider survey of state of the art in interactive
graphics for large datasets.

Hadley



------------------------------

Message: 12
Date: Sun, 19 Aug 2007 18:29:38 +0000 (GMT)
From: adschai at optonline.net
Subject: [R] Prerequisite for running RWeka
To: r-help at stat.math.ethz.ch
Message-ID: <e7fec07027beb.46c88c12 at optonline.net>
Content-Type: text/plain; charset=us-ascii

Hi - 

I have a question on RWeka. I installed the package and try to run using
some examples available in the package. However, it stalls my machine for a
while. I'm wondering if I need weka (which is java implementation) installed
before using RWeka? Thank you.

- adschai



------------------------------

Message: 13
Date: Sun, 19 Aug 2007 18:32:12 +0000 (GMT)
From: adschai at optonline.net
Subject: [R] Question on R server and TinnR
To: r-help at stat.math.ethz.ch
Message-ID: <e666c38627816.46c88cac at optonline.net>
Content-Type: text/plain; charset=us-ascii

Hi -

Classic question that I tried to look up online and couldn't find a clear
answer. It seems that I can have R to act as a server. But I never know how
this works. Would anyone please provide an example or introduction material
where I can learn about this? I'm trying to build an environment where
computation are distributed/delegated among different servers requested
whenever I need. Thank you.

- adschai



------------------------------

Message: 14
Date: Sun, 19 Aug 2007 19:41:10 +0100 (BST)
From: Prof Brian Ripley <ripley at stats.ox.ac.uk>
Subject: Re: [R] Prerequisite for running RWeka
To: adschai at optonline.net
Cc: r-help at stat.math.ethz.ch
Message-ID: <Pine.LNX.4.64.0708191936220.15538 at gannet.stats.ox.ac.uk>
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed

On Sun, 19 Aug 2007, adschai at optonline.net wrote:

> Hi -
>
> I have a question on RWeka. I installed the package and try to run using 
> some examples available in the package. However, it stalls my machine 
> for a while. I'm wondering if I need weka (which is java implementation) 
> installed before using RWeka? Thank you.

No, and if it did it should be listed in the DESCRIPTION file (and given 
that the maintainer of RWeka wrote the rules, it would be).

> R-help at stat.math.ethz.ch 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.

PLEASE do!  We don't know your OS, version of R, version of RWeka, version 
of Java, what 'stalls' means, what the maintainer said when you asked him 
(as required by the posting guide) ... in short anything we need to even 
guess at the problem.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



------------------------------

Message: 15
Date: Sun, 19 Aug 2007 12:13:42 -0700 (PDT)
From: Anup Nandialath <anup_nandialath at yahoo.com>
Subject: [R] Creating a data set within a function
To: r-help at stat.math.ethz.ch
Message-ID: <247229.81515.qm at web53311.mail.re2.yahoo.com>
Content-Type: text/plain

Dear Friends,

I'm trying to find if there is a way to automate creation of the design
matrix. Suppose we are interested in say running an autoregressive model.
The user inputs the following data

myfunAR <- function(y, order)
{.....
......
}

now here y is the data series and order represents the level of the process.
In other words if order=2 then we have an AR (2) process. Now it is easy to
to create the y vector within the function, but I'm not clear on how to
create the design matrix. 

For instance if order=2 then

y <- as.matrix(rnorm(100))
ynew <- as.matrix(y[3:nrow(y),1])
x <- as.matrix(cbind(rep(1, nrow(y)-2), y[2:(nrow(y)-1),1],
y[1:(nrow(y)-2),1]))

ynew and x gives me the response vector and design matrix respectively.
however, I'm trying to write a general function which will accomodate any
order. Hence given the user inputs y and the order, is there a way to
program the creation of the x matrix automatically. 

The long way would be

if (order=1)
{%%%%%%%%%5}

if (order=2)
{%%%%%%%%%%%%%5}

but this will force me to limit at some point.Is there an alternative way to
program this??

Thanks in advance
Regards

Anup



       
---------------------------------
Building a website is a piece of cake. 

	[[alternative HTML version deleted]]



------------------------------

Message: 16
Date: Sun, 19 Aug 2007 15:56:08 -0400
From: "Gabor Grothendieck" <ggrothendieck at gmail.com>
Subject: Re: [R] Creating a data set within a function

Cc: r-help at stat.math.ethz.ch
Message-ID:
	<971536df0708191256s58036870v59a00ba62eb851 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Check out ?embed


> Dear Friends,
>
> I'm trying to find if there is a way to automate creation of the design
matrix. Suppose we are interested in say running an autoregressive model.
The user inputs the following data
>
> myfunAR <- function(y, order)
> {.....
> ......
> }
>
> now here y is the data series and order represents the level of the
process. In other words if order=2 then we have an AR (2) process. Now it is
easy to to create the y vector within the function, but I'm not clear on how
to create the design matrix.
>
> For instance if order=2 then
>
> y <- as.matrix(rnorm(100))
> ynew <- as.matrix(y[3:nrow(y),1])
> x <- as.matrix(cbind(rep(1, nrow(y)-2), y[2:(nrow(y)-1),1],
y[1:(nrow(y)-2),1]))
>
> ynew and x gives me the response vector and design matrix respectively.
however, I'm trying to write a general function which will accomodate any
order. Hence given the user inputs y and the order, is there a way to
program the creation of the x matrix automatically.
>
> The long way would be
>
> if (order=1)
> {%%%%%%%%%5}
>
> if (order=2)
> {%%%%%%%%%%%%%5}
>
> but this will force me to limit at some point.Is there an alternative way
to program this??
>
> Thanks in advance
> Regards
>
> Anup
>
>
>
>
> ---------------------------------
> Building a website is a piece of cake.
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>



------------------------------

Message: 17
Date: Sun, 19 Aug 2007 13:37:45 -0700
From: "Darren Weber" <darren.weber.lists at gmail.com>
Subject: [R] How to parse a string into the symbol for a data frame
	object
To: r-help at stat.math.ethz.ch
Message-ID:
	<b808b3510708191337i1100313s90234cb542c3f161 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

 I have several data frames, eg:

> df1 <- data.frame(x=seq(0,10), y=seq(10,20))
> df2 <- data.frame(a=seq(0,10), b=seq(10,20))

It is common to create loops in R like this:

> for(df in list(df1, df2)){ #etc. }

This works fine when you know the name of the objects to put into the
list.  I assume that the order of the objects in the list is respected
through the loop.  Inside the loop, the objects of the list are
'dereferenced' using 'df' but, to my knowledge, there is no way to
tell whether 'df' is a current representation of 'df1' or 'df2'
without some additional book keeping.

In addition, I really want to use 'paste' within the loop to create a
new string value that will have the symbol name of a data frame to be
"dereferenced," e.g.:

> for(n in c(1, 2)){ dfString <- paste('df', n, sep="");
print(eval(dfString)) }

[1] "df1"
[1] "df2"

This is not what I want.  I have read through the documentation on
eval and similar commands like substitute and quote.  I program
regularly, but I do not understand these constructs in R.  I do not
understand the R framework for parsing and evaluation and I don't have
a lot of time right now to get lost in this detail.  I could really
use some help to get the string values in my loop to be parsed into
symbols that refer to the data frame objects df1 and df2.  How is this
done?

Best, Darren



------------------------------

Message: 18
Date: Sun, 19 Aug 2007 17:22:24 -0400
From: "jim holtman" <jholtman at gmail.com>
Subject: Re: [R] How to parse a string into the symbol for a data
	frame	object
To: "Darren Weber" <darren.weber.lists at gmail.com>
Cc: r-help at stat.math.ethz.ch
Message-ID:
	<644e1f320708191422x345820f7t52f0fc63fd061404 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

One way to do it is to pass in the character name of the dataframe you
want to reference and then use 'get' to access the value: e.g.,

df1 <- data.frame(x=seq(0,10), y=seq(10,20))
df2 <- data.frame(a=seq(0,10), b=seq(10,20))
# use the character names for referencing
for (df in c('df1', 'df2')){
    # get the data to operate on (read-only)
    .val <- get(df)
    # now you can reference the object
    print(names(.val))
    # or construct new objects to store the value in
    # or you can use "assign' to store back in the original object
    assign(paste('temp.', df, sep=''), .val)
}


On 8/19/07, Darren Weber <darren.weber.lists at gmail.com> wrote:
>  I have several data frames, eg:
>
> > df1 <- data.frame(x=seq(0,10), y=seq(10,20))
> > df2 <- data.frame(a=seq(0,10), b=seq(10,20))
>
> It is common to create loops in R like this:
>
> > for(df in list(df1, df2)){ #etc. }
>
> This works fine when you know the name of the objects to put into the
> list.  I assume that the order of the objects in the list is respected
> through the loop.  Inside the loop, the objects of the list are
> 'dereferenced' using 'df' but, to my knowledge, there is no way to
> tell whether 'df' is a current representation of 'df1' or 'df2'
> without some additional book keeping.
>
> In addition, I really want to use 'paste' within the loop to create a
> new string value that will have the symbol name of a data frame to be
> "dereferenced," e.g.:
>
> > for(n in c(1, 2)){ dfString <- paste('df', n, sep="");
print(eval(dfString)) }
>
> [1] "df1"
> [1] "df2"
>
> This is not what I want.  I have read through the documentation on
> eval and similar commands like substitute and quote.  I program
> regularly, but I do not understand these constructs in R.  I do not
> understand the R framework for parsing and evaluation and I don't have
> a lot of time right now to get lost in this detail.  I could really
> use some help to get the string values in my loop to be parsed into
> symbols that refer to the data frame objects df1 and df2.  How is this
> done?
>
> Best, Darren
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>


-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?



------------------------------

Message: 19
Date: Sun, 19 Aug 2007 16:57:21 -0700 (PDT)

Subject: [R] Error bars using data from bugs()
To: r-help at stat.math.ethz.ch
Message-ID: <176510.62526.qm at web52312.mail.re2.yahoo.com>
Content-Type: text/plain

I'm trying to compare the results of several models using output from
bugs(). I want to summarize the models via boxplots or lineplots of the
parameters. I know how to use errorbars from a regression, but how do I
implement the credible intervals as error bars into these plots

Any help is much appreciated

Matthew Krachey
 

	[[alternative HTML version deleted]]



------------------------------

Message: 20
Date: Sun, 19 Aug 2007 21:09:23 -0400
From: "Gabor Grothendieck" <ggrothendieck at gmail.com>
Subject: Re: [R] How to parse a string into the symbol for a data
	frame	object
To: "Darren Weber" <darren.weber.lists at gmail.com>
Cc: r-help at stat.math.ethz.ch
Message-ID:
	<971536df0708191809m7d708135y46217904606e3f1d at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

You might want to store the data frames in a list to eliminate this
problem and make it more convenient to iterate over them:

L <- list(df1 = df1, df2 = df2)
rm(df1, df2)

# reduce each data frame to its first few rows
for(nm in names(L))   L[[nm]] <- head(L[[nm])

or if you don't need to modify them or know their names:

# print first few lines of each
for(df in L) print(head(df))


On 8/19/07, Darren Weber <darren.weber.lists at gmail.com> wrote:
>  I have several data frames, eg:
>
> > df1 <- data.frame(x=seq(0,10), y=seq(10,20))
> > df2 <- data.frame(a=seq(0,10), b=seq(10,20))
>
> It is common to create loops in R like this:
>
> > for(df in list(df1, df2)){ #etc. }
>
> This works fine when you know the name of the objects to put into the
> list.  I assume that the order of the objects in the list is respected
> through the loop.  Inside the loop, the objects of the list are
> 'dereferenced' using 'df' but, to my knowledge, there is no way to
> tell whether 'df' is a current representation of 'df1' or 'df2'
> without some additional book keeping.
>
> In addition, I really want to use 'paste' within the loop to create a
> new string value that will have the symbol name of a data frame to be
> "dereferenced," e.g.:
>
> > for(n in c(1, 2)){ dfString <- paste('df', n, sep="");
print(eval(dfString)) }
>
> [1] "df1"
> [1] "df2"
>
> This is not what I want.  I have read through the documentation on
> eval and similar commands like substitute and quote.  I program
> regularly, but I do not understand these constructs in R.  I do not
> understand the R framework for parsing and evaluation and I don't have
> a lot of time right now to get lost in this detail.  I could really
> use some help to get the string values in my loop to be parsed into
> symbols that refer to the data frame objects df1 and df2.  How is this
> done?
>
> Best, Darren
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>



------------------------------

Message: 21
Date: Mon, 20 Aug 2007 01:13:03 +0000 (GMT)
From: adschai at optonline.net
Subject: [R] how to collapse a list of 1 column matrix to a matrix?
To: r-help at stat.math.ethz.ch
Message-ID: <f82ac3e225744.46c8ea9f at optonline.net>
Content-Type: text/plain; charset=us-ascii

Hi, 

I encounter a situation where I have a list whose element is a column
matrix. Says, 

$'1'
[,1]
1
2
3

$'2'
[,1]
4
5
6

Is there fast way to collapse the list into a matrix like a cbind operation
in this case? Meaning, the result should be a matrix that looks like:

      [,1]  [,2]
[1,]    1      4
[2,]    2      5
[3,]    3      6

I can loop through all elements and do cbind manually. But I think there
must be a simpler way that I don't know. Thank you.

- adschai



------------------------------

Message: 22
Date: Sun, 19 Aug 2007 21:33:15 -0400
From: Fran?ois Pinard <pinard at iro.umontreal.ca>
Subject: Re: [R] how to collapse a list of 1 column matrix to a
	matrix?
To: adschai at optonline.net
Cc: r-help at stat.math.ethz.ch
Message-ID: <20070820013315.GA22706 at phenix.progiciels-bpi.ca>
Content-Type: text/plain; charset=iso-8859-1; format=flowed

[adschai at optonline.net]

>I encounter a situation where I have a list whose element is a column 
>matrix. Says,

>$'1'
>[,1]
>1
>2
>3

>$'2'
>[,1]
>4
>5
>6

>Is there fast way to collapse the list into a matrix like a cbind 
>operation in this case? Meaning, the result should be a matrix that 
>looks like: 

>      [,1]  [,2]
>[1,]    1      4
>[2,]    2      5
>[3,]    3      6

>I can loop through all elements and do cbind manually. But I think 
>there must be a simpler way that I don't know. Thank you.

The "do.call" function is the R equivalent of the "apply" from many 
other languages.  I guess that, in R, "apply" was already taken :-)
For example:

> a = list(x=matrix(1:3, 3, 1), y=matrix(4:6, 3, 1))
> a
$x
     [,1]
[1,]    1
[2,]    2
[3,]    3

$y
     [,1]
[1,]    4
[2,]    5
[3,]    6

> do.call(cbind, a)
     [,1] [,2]
[1,]    1    4
[2,]    2    5
[3,]    3    6


-- 
Fran?ois Pinard   http://pinard.progiciels-bpi.ca



------------------------------

Message: 23
Date: Mon, 20 Aug 2007 01:39:25 +0000 (GMT)
From: adschai at optonline.net
Subject: Re: [R] how to collapse a list of 1 column matrix to a
	matrix?
To: Fran?ois Pinard <pinard at iro.umontreal.ca>
Cc: r-help at stat.math.ethz.ch
Message-ID: <dfe19df8229ae.46c8f0cd at optonline.net>
Content-Type: text/plain

Ah, it works. I was using lapply and it doesn't seem to work. Thank
you!----- Original Message -----From: Frangois Pinard Date: Sunday, August
19, 2007 8:36 pmSubject: Re: [R] how to collapse a list of 1 column matrix
to a matrix?To: adschai at optonline.netCc: r-help at stat.math.ethz.ch>
[adschai at optonline.net]> > >I encounter a situation where I have a list
whose element is a > column > >matrix. Says,> > >$'1'> >[,1]> >1> >2> >3> >
>$'2'> >[,1]> >4> >5> >6> > >Is there fast way to collapse the list into a
matrix like a > cbind > >operation in this case? Meaning, the result should
be a matrix > that > >looks like: > > >      [,1]  [,2]> >[1,]    1      4>
>[2,]    2      5> >[3,]    3      6> > >I can loop through all elements and
do cbind manually. But I > think > >there must be a simpler way that I don't
know. Thank you.> > The "do.call" function is the R equivalent of the
"apply" from > many > other languages.  I guess that, in R, "apply" was
[[replacing trailing spam]]
 > > > a = list(x=matrix(1:3, 3, 1), y=matrix(4:6, 3, 1))> > a> $x>
[,1]> [1,]    1> [2,]    2> [3,]    3> > $y>     [,1]> [1,]    4> [2,]    5>
[3,]    6> > > do.call(cbind, a)>     [,1] [,2]> [1,]    1    4> [2,]    2
5> [3,]    3    6> > > -- > Frangois Pinard
http://pinard.progiciels-bpi.ca>

	[[alternative HTML version deleted]]



------------------------------

Message: 24
Date: Sun, 19 Aug 2007 21:48:32 -0400
From: "Gabor Grothendieck" <ggrothendieck at gmail.com>
Subject: Re: [R] how to collapse a list of 1 column matrix to a
	matrix?
To: "adschai at optonline.net" <adschai at optonline.net>
Cc: r-help at stat.math.ethz.ch
Message-ID:
	<971536df0708191848j7f63ee0ds482033b4bf24850d at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Try this:

L <- list(`1` = matrix(1:4, 4), `2` = matrix(5:8, 4))
sapply(L, c)

Note that the list component names are kept as column names in the result


On 8/19/07, adschai at optonline.net <adschai at optonline.net> wrote:
> Hi,
>
> I encounter a situation where I have a list whose element is a column
matrix. Says,
>
> $'1'
> [,1]
> 1
> 2
> 3
>
> $'2'
> [,1]
> 4
> 5
> 6
>
> Is there fast way to collapse the list into a matrix like a cbind
operation in this case? Meaning, the result should be a matrix that looks
like:
>
>      [,1]  [,2]
> [1,]    1      4
> [2,]    2      5
> [3,]    3      6
>
> I can loop through all elements and do cbind manually. But I think there
must be a simpler way that I don't know. Thank you.
>
> - adschai
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>



------------------------------

Message: 25
Date: Sun, 19 Aug 2007 22:22:07 -0400
From: "John Fox" <jfox at mcmaster.ca>
Subject: Re: [R] Rcmdr window border lost
To: <weller at erdw.ethz.ch>, <p.dalgaard at biostat.ku.dk>
Cc: r-help at stat.math.ethz.ch
Message-ID:
	
<20070820022214.TBCM26794.tomts43-srv.bellnexxia.net at JohnDesktop8300>
Content-Type: text/plain;	charset="us-ascii"

Dear Andy and Peter,

My apologies for chiming in so late, but I was out of town and just caught
up with R-help today (and an impressive amount of material accumulates on
R-help in a couple of weeks!).

Although I develop the Rcmdr package on a Windows system, I test it under
Linux as well -- most recently on Ubuntu 7.04 with R 2.5.0. Curiously, the
windows for Rcmdr 1.3-5 look normal to me, as I just verified, so I'm unable
to reproduce the problem, and wonder whether anyone else has seen it.

As well, setting options(Rmcdr=list(suppress.X11.warnings=TRUE)) should
suppress the X11 warnings that appear on some systems, but I thought that
this problem disappeared with R 2.4.0. See ?Commander.

Regards,
 John

------- original messages ------

Andy Weller wrote:
> OK, I tried completely removing and reinstalling R, but this has not 
> worked - I am still missing window borders for Rcmdr. I am certain that 
> everything is installed correctly and that all dependencies are met - 
[[replacing trailing spam]]
>
> Thanks in advance, Andy
>
> Andy Weller wrote:
>   
>> Dear all,
>>
>> I have recently lost my Rcmdr window borders (all my other programs have 
>> borders)! I am unsure of what I have done, although I have recently 
>> update.packages() in R... How can I reclaim them?
>>
>> I am using:
>> Ubuntu Linux (Feisty)
>> R version 2.5.1
>> R Commander Version 1.3-5
>>
>>     
This sort of behaviour is usually the fault of the window manager, not 
R/Rcmdr/tcltk. It's the WM's job to supply the various window 
decorations on a new window, so either it never got told that there was 
a window, or it somehow got into a confused state. Did you try 
restarting the WM (i.e., log out/in or reboot)? And which WM are we 
talking about?

Same combination works fine on Fedora 7, except for a load of messages 
saying

Warning: X11 protocol error: BadWindow (invalid Window parameter)


>> I have deleted the folder: /usr/local/lib/R/site-library/Rcmdr and 
>> reinstalled Rcmdr with: install.packages("Rcmdr", dep=TRUE)
>>
>> This has not solved my problem though.
>>
>> Maybe I need to reinstall something else as well?
>>
>> Thanks in advance, Andy
>>     

--------------------------------
John Fox, Professor
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8S 4M4
905-525-9140x23604
http://socserv.mcmaster.ca/jfox



------------------------------

Message: 26
Date: Mon, 20 Aug 2007 02:25:14 +0000 (GMT)
From: adschai at optonline.net
Subject: Re: [R] how to collapse a list of 1 column matrix to a
	matrix?
To: r-help at stat.math.ethz.ch
Message-ID: <e7fefdcf25539.46c8fb8a at optonline.net>
Content-Type: text/plain; charset=us-ascii

One more question. After I collapse everything into one matrix, I would like
to find the index of column that holds minimum value for each row. I
remember that there is a function like maxCols but I can't seem to find the
same thing for minimum value. Any suggestion please?

- adschai


 ----- Original Message -----From: Gabor Grothendieck Date: Sunday, August
19, 2007 8:48 pmSubject: Re: [R] how to collapse a list of 1 column matrix
to a matrix?To: "adschai at optonline.net" Cc: r-help at stat.math.ethz.ch> Try
this:> > L <- list(`1` = matrix(1:4, 4), `2` = matrix(5:8, 4))> sapply(L,
c)> > Note that the list component names are kept as column names in > the
result> > > On 8/19/07, adschai at optonline.net  wrote:> > Hi,> >> > I
encounter a situation where I have a list whose element is a > column
matrix. Says,> >> > $'1'> > [,1]> > 1> > 2> > 3> >> > $'2'> > [,1]> > 4> >
5> > 6> >> > Is there fast way to collapse the list into a matrix like a >
cbind operation in this case? Meaning, the result should be a > matrix that
looks like:> >> >      [,1]  [,2]> > [1,]    1      4> > [2,]    2      5> >
[3,]    3      6> >> > I can loop through all elements and do cbind
manually. But I > think there must be a simpler way that I don't know. Thank
[[replacing trailing spam]]
 ____________________________________________> > R-help at stat.math.ethz.ch
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.> >>



------------------------------

Message: 27
Date: Sun, 19 Aug 2007 22:31:56 -0400
From: "John Fox" <jfox at mcmaster.ca>
Subject: Re: [R] SEM for categorical data
To: <upasna at iitb.ac.in>
Cc: r-help at stat.math.ethz.ch
Message-ID:
	
<20070820023202.VRPK18413.tomts22-srv.bellnexxia.net at JohnDesktop8300>
Content-Type: text/plain;	charset="us-ascii"

Dear Upasna,

I apologize for responding so late, but I was out of town when you posted
your query to r-help.

The sem() function in the sem package can handle dichotomous and ordered
categorical observed variables via tetrachoric, polychoric, biserial, and
polyserial correlations computed by the polycor package. See in particular
the hetcor() function in that package, which can compute "heterogeneous"
correlation matrices. Standard errors for parameter estimates in the SEM can
then be computed by bootstrapping; see ?boot.sem in the sem package for an
example with a confirmatory factor-analysis model for ordinal observed
variables.

I hope that this helps,
 John

------- original message -------

Hi

I am looking for a structural equation modeling package in R which can be
used for categorical data. Is anyone aware of the existence of such a
package? Would appreciate any help on this.

Thank you
Upasna

-- 
---------------------------------------------------------------------
Upasna Sharma
Research Scholar
Shailesh J. Mehta School of Management,
Indian Institute of Technology, Bombay
Powai, Mumbai - 400076, India

--------------------------------
John Fox, Professor
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8S 4M4
905-525-9140x23604
http://socserv.mcmaster.ca/jfox



------------------------------

Message: 28
Date: Mon, 20 Aug 2007 10:56:43 +0800
From: "Jared O'Connell" <jared.oconnell at csiro.au>
Subject: Re: [R] how to collapse a list of 1 column matrix to a
	matrix?
To: "adschai at optonline.net" <adschai at optonline.net>
Cc: r-help at stat.math.ethz.ch
Message-ID:
	<8c464e8f0708191956w5abbe4e2h821e1f81415de128 at mail.gmail.com>
Content-Type: text/plain

> x = matrix(rnorm(9),3)
> x
            [,1]       [,2]        [,3]
[1,]  1.29693748  0.2018959  0.02534092
[2,] -1.19468858 -1.2249229 -0.85948508
[3,] -0.09274508  0.4071841 -0.11481410
> apply(x,1,which.min)
[1] 3 2 3



On 8/20/07, adschai at optonline.net <adschai at optonline.net> wrote:
>
> One more question. After I collapse everything into one matrix, I would
> like to find the index of column that holds minimum value for each row. I
> remember that there is a function like maxCols but I can't seem to find
the
> same thing for minimum value. Any suggestion please?
>
> - adschai
>
>
> ----- Original Message -----From: Gabor Grothendieck Date: Sunday, August
> 19, 2007 8:48 pmSubject: Re: [R] how to collapse a list of 1 column matrix
> to a matrix?To: "adschai at optonline.net" Cc: r-help at stat.math.ethz.ch> Try
> this:> > L <- list(`1` = matrix(1:4, 4), `2` = matrix(5:8, 4))> sapply(L,
> c)> > Note that the list component names are kept as column names in > the
> result> > > On 8/19/07, adschai at optonline.net  wrote:> > Hi,> >> > I
> encounter a situation where I have a list whose element is a > column
> matrix. Says,> >> > $'1'> > [,1]> > 1> > 2> > 3> >> > $'2'> > [,1]> > 4> >
> 5> > 6> >> > Is there fast way to collapse the list into a matrix like a >
> cbind operation in this case? Meaning, the result should be a > matrix
that
> looks like:> >> >      [,1]  [,2]> > [1,]    1      4> > [2,]    2      5>
>
> [3,]    3      6> >> > I can loop through all elements and do cbind
> manually. But I > think there must be a simpler way that I don't know.
Thank
[[replacing trailing spam]]
> ____________________________________________> >
R-help at stat.math.ethz.chmailing 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.> >>
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>

	[[alternative HTML version deleted]]



------------------------------

Message: 29
Date: Sun, 19 Aug 2007 21:59:50 -0500
From: "A. Beaujean" <abeaujean at gmail.com>
Subject: Re: [R] SEM for categorical data
To: upasna at iitb.ac.in, r-help at stat.math.ethz.ch
Message-ID:
	<c74b04310708191959t77806c57jbe2e4ce64a67d873 at mail.gmail.com>
Content-Type: text/plain

Also, various IRT packages might likely work, as IRT is really just SEM with
catagorial outcomes. See:
http://cran.r-project.org/src/contrib/Views/Psychometrics.html

Alex

On 8/19/07, John Fox <jfox at mcmaster.ca> wrote:
>
> Dear Upasna,
>
> I apologize for responding so late, but I was out of town when you posted
> your query to r-help.
>
> The sem() function in the sem package can handle dichotomous and ordered
> categorical observed variables via tetrachoric, polychoric, biserial, and
> polyserial correlations computed by the polycor package. See in particular
> the hetcor() function in that package, which can compute "heterogeneous"
> correlation matrices. Standard errors for parameter estimates in the SEM
> can
> then be computed by bootstrapping; see ?boot.sem in the sem package for an
> example with a confirmatory factor-analysis model for ordinal observed
> variables.
>
> I hope that this helps,
> John
>
> ------- original message -------
>
> Hi
>
> I am looking for a structural equation modeling package in R which can be
> used for categorical data. Is anyone aware of the existence of such a
> package? Would appreciate any help on this.
>
> Thank you
> Upasna
>
> --
> ---------------------------------------------------------------------
> Upasna Sharma
> Research Scholar
> Shailesh J. Mehta School of Management,
> Indian Institute of Technology, Bombay
> Powai, Mumbai - 400076, India
>
> --------------------------------
> John Fox, Professor
> Department of Sociology
> McMaster University
> Hamilton, Ontario
> Canada L8S 4M4
> 905-525-9140x23604
> http://socserv.mcmaster.ca/jfox
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>



-- 
***************
A. Alexander Beaujean, Ph.D., LSSP
Licensed Psychologist (Provisional, TX)
http://myprofile.cos.com/abeaujean
http://www.baylor.edu/soe/faculty/index.php?id=38476


"General impressions are never to be trusted. Unfortunately when they are of
long standing they become fixed rules of life, and assume a prescriptive
right not to be questioned. Consequently those who are not accustomed to
original inquiry entertain a hatred and a horror of statistics. They cannot
endure the idea of submitting their sacred  impressions to cold-blooded
verification. But it is the triumph of scientific men to rise superior to
such superstitions, to devise tests by which the value of beliefs may be
ascertained, and to feel sufficiently masters of themselves to discard
contemptuously whatever may be found untrue." --Sir Francis Galton, FRS

	[[alternative HTML version deleted]]



------------------------------

Message: 30
Date: Mon, 20 Aug 2007 13:01:51 +1000
From: "Felix Andrews" <felix at nfrac.org>
Subject: Re: [R] Does anyone else think this might be worth a
	warning?!?
To: "Matthew Walker" <m.g.walker at massey.ac.nz>
Cc: r-help at stat.math.ethz.ch
Message-ID:
	<94730b8a0708192001w100da322y9846b70dd2be2d91 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-2022-JP

I do think this is worth a warning.
mean.default could do something like
if (length(list(...)) > 0) warning("extra arguments ignored")

The same could also apply to many other methods of S3 generic
functions which are forced to include the formal argument `...` in the
signature but do not use it.

Felix


On 8/19/07, Matthew Walker <m.g.walker at massey.ac.nz> wrote:
> Hi,
>
> I was *very* surprised by this little trick for new players: mean() only
[[replacing trailing spam]]
>
>  > mean(1,1,2)
> [1] 1
>  > mean(2,1,1)
> [1] 2
>
>
> I found this very different behaviour to max():
>
>  > max(1,1,2)
> [1] 2
>  > max(2,1,1)
> [1] 2
>
>
>
> Perhaps this is the wrong list to ask, but does anyone else think this a
> little on the interesting side?  Is it not possible to detect a first
> argument of length one in the presence of other un-named arguments and
> at least produce a warning?
>
>
> Cheers,
>
>
> Matthew
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>


-- 
Felix Andrews / ???
PhD candidate
Integrated Catchment Assessment and Management Centre
The Fenner School of Environment and Society
The Australian National University (Building 48A), ACT 0200
Beijing Bag, Locked Bag 40, Kingston ACT 2604
http://www.neurofractal.org/felix/
voice:+86_1051404394 (in China)
mobile:+86_13522529265 (in China)
mobile:+61_410400963 (in Australia)
xmpp:foolish.android at gmail.com
3358 543D AAC6 22C2 D336  80D9 360B 72DD 3E4C F5D8



------------------------------

Message: 31
Date: Sun, 19 Aug 2007 23:26:20 -0400
From: Fran?ois Pinard <pinard at iro.umontreal.ca>
Subject: Re: [R] how to collapse a list of 1 column matrix to a
	matrix?
To: adschai at optonline.net
Cc: r-help at stat.math.ethz.ch
Message-ID: <20070820032620.GA26439 at phenix.progiciels-bpi.ca>
Content-Type: text/plain; charset=iso-8859-1; format=flowed

[adschai at optonline.net]
> One more question. After I collapse everything into one matrix, 
> I would like to find the index of column that holds minimum value for 
> each row. I remember that there is a function like maxCols but I can't 
> seem to find the same thing for minimum value.  Any suggestion please?

Here is a possible avenue:

> z <- matrix(sample(1:25), 5)
> z
     [,1] [,2] [,3] [,4] [,5]
[1,]   16    2    9   24    7
[2,]   21   19   22   23   18
[3,]   12    3    5   13   15
[4,]   20    4   25   11   10
[5,]   17    1    8   14    6
> apply(z, 2, which.min)
[1] 3 5 3 4 5

I would presume (yet I did not recently check) that "do.call", 
"which.min", and a flurry of other useful functions, are introduced in 
various R tutorials.  If you plan to use R seriously, it might be worth 
scrutinizing a few of those.

[[replacing trailing spam]]

-- 
Fran?ois Pinard   http://pinard.progiciels-bpi.ca



------------------------------

Message: 32
Date: Mon, 20 Aug 2007 05:13:09 +0000 (GMT)
From: adschai at optonline.net
Subject: Re: [R] how to collapse a list of 1 column matrix to a
	matrix?
To: "Jared O'Connell" <jared.oconnell at csiro.au>
Cc: r-help at stat.math.ethz.ch
Message-ID: <e3d1e5b227467.46c922e5 at optonline.net>
Content-Type: text/plain; charset=us-ascii

Thank you. I found the same answer.

----- Original Message -----From: Jared O'Connell Date: Sunday, August 19,
2007 9:56 pmSubject: Re: [R] how to collapse a list of 1 column matrix to a
matrix?To: "adschai at optonline.net" Cc: r-help at stat.math.ethz.ch> > x =
matrix(rnorm(9),3)> > x>            [,1]       [,2]        [,3]> [1,]
1.29693748  0.2018959  0.02534092> [2,] -1.19468858 -1.2249229 -0.85948508>
[3,] -0.09274508  0.4071841 -0.11481410> > apply(x,1,which.min)> [1] 3 2 3>
> > > On 8/20/07, adschai at optonline.net  wrote:> >> > One more question.
After I collapse everything into one > matrix, I would> > like to find the
index of column that holds minimum value for > each row. I> > remember that
there is a function like maxCols but I can't > seem to find the> > same
thing for minimum value. Any suggestion please?> >> > - adschai> >> >> >
----- Original Message -----From: Gabor Grothendieck Date: > Sunday, August>
> 19, 2007 8:48 pmSubject: Re: [R] how to collapse a list of 1 > column
[[replacing trailing spam]]
 "adschai at optonline.net" Cc: r-> help at stat.math.ethz.ch> Try> > this:> > L
<- list(`1` = matrix(1:4, 4), `2` = matrix(5:8, > 4))> sapply(L,> > c)> >
Note that the list component names are kept as column > names in > the> >
result> > > On 8/19/07, adschai at optonline.net  wrote:> > Hi,> > >> > I> >
encounter a situation where I have a list whose element is a > > column>
matrix. Says,> >> > $'1'> > [,1]> > 1> > 2> > 3> >> > > $'2'> > [,1]> > 4>
>> > 5> > 6> >> > Is there fast way to collapse the list into a > matrix
like a >> > cbind operation in this case? Meaning, the result should be a >
> matrix that> > looks like:> >> >      [,1]  [,2]> > [1,]    1      4> >
[2,]  >  2      5> >> > [3,]    3      6> >> > I can loop through all
elements and do cbind> > manually. But I > think there must be a simpler way
that I > don't know. Thank> > you.> >> > - adschai> >> > __!> >
____________________________________________> > R->
[[replacing trailing spam]]
 .ch/mailman/listinfo/r-help> > PLEASE do read > the posting> > guide h
ttp://www.R-> project.org/posting-guide.html> > and provide> > commented,
minimal, self-contained, reproducible code.> >>> >> >
______________________________________________> > R-help at stat.math.ethz.ch
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.> >>



------------------------------

Message: 33
Date: Sun, 19 Aug 2007 10:12:16 +0000
From: "jakob bleier" <chimaere47 at hotmail.com>
Subject: [R] Building Packages with AnnBuilder
To: r-help at stat.math.ethz.ch
Message-ID: <BAY112-F3640C3388B725AB7DC5AA4D0DA0 at phx.gbl>
Content-Type: text/plain; charset=iso-8859-1; format=flowed

Hi there.
I got some Problems building an Annotation-Package with AnnBuilder.
Not using the function ABPkgBuilder(), but just parts of it to create a 
package without connecting to the servers, I managed to create a Package, 
but it seems to be empty. R recognizes it as a package, but is unable to 
load it.
The form of the data is in a correct form, I got an example-annotation-file 
the function uses.
I'm sorry if i'm missing informations because i'm very new to R, using it at

an internship.
Thanks for helping and greetings,
Jakob B.



------------------------------

Message: 34
Date: Mon, 20 Aug 2007 12:43:49 +0530
From: "Shubha Vishwanath Karanth" <shubhak at ambaresearch.com>
Subject: [R] Differentiation
To: <r-help at stat.math.ethz.ch>
Message-ID:
	<A36876D3F8A5734FA84A4338135E7CC30252EE01 at BAN-MAILSRV03.Amba.com>
Content-Type: text/plain

Hi,

 

Could anyone tell me what is the command used in R to do 

1.	Differentiation
2.	Newton Raphson method (Numerical Analysis in general...)

 

Are there any packages separately for this?

 

[[replacing trailing spam]]

 

BR, Shubha


	[[alternative HTML version deleted]]



------------------------------

Message: 35
Date: Mon, 20 Aug 2007 00:33:11 -0700 (PDT)
From: squall44 <tobias.minder at bluewin.ch>
Subject: [R] Labelling certain points on the x-axis
To: r-help at stat.math.ethz.ch
Message-ID: <12231344.post at talk.nabble.com>
Content-Type: text/plain; charset=us-ascii


Hello,

I created an empirical distribution function:

x = c(1.6,1.8,2.4,2.7,2.9,3.3,3.4,3.4,4,5.2)
F2.5 <- ecdf(x)
plot(F2.5, 
     verticals= TRUE, 
     do.p = TRUE, 
     lwd=3, 
     ylab = "f(x)", 
     xlab = "x", 
     main = "Figur 2.5 Empirische Verteilfunktion", 
     xlim = c(1,5.5))
abline(h= (0:5)*0.2)

Now I would like to label the points on the x-axis where there is an
x-value:

http://www.nabble.com/file/p12231344/figur.gif 

I don't know how to do that... can anyone help me?
Thanks
-- 
View this message in context:
http://www.nabble.com/Labelling-certain-points-on-the-x-axis-tf4297126.html#
a12231344
Sent from the R help mailing list archive at Nabble.com.



------------------------------

Message: 36
Date: Mon, 20 Aug 2007 09:00:36 +0100
From: "Pfaff, Bernhard Dr." <Bernhard_Pfaff at fra.invesco.com>
Subject: Re: [R] Restricted VAR parameter estimation

Message-ID:
	
<B89F0CE41D45644A97CCC93DF548C1C30A76F0E6 at GBHENXMB02.corp.amvescap.net>
	
Content-Type: text/plain; charset="us-ascii"

Hello Megh,

in principle you can do OLS on an equation-per-equation basis. However,
in this case the estimator might be asymptotically inefficient. One can
use FGLS instead. This is outlined for instance in:

Helmut Luetkepohl, 2007. "Econometric Analysis with Vector
Autoregressive Models," Economics Working Papers ECO2007/11, European
University Institute. 
http://cadmus.iue.it/dspace/bitstream/1814/6918/1/ECO-2007-11.pdf

Incidentally, you can also use restrict() [OLS-based] in package vars;
version 1.3-1 has been uploaded to /incoming on CRAN and it should
appear on the mirrors soon. 

Best,
Bernhard 


>
>I have a VAR model with five macro-economic variables, y[1], 
>y[2], y[3], y[4], y[5]. They are related to each other in 
>following manner.
>
>y[1,t] = alpha[1,0] + beta[1,1, 
>1]*y[1,t-1]+............+beta[1,1, 12]*y[1,t-12] + beta[1,2, 
>1]*y[2,t-1]+............+beta[1,2, 12]*y[2,t-12] + e[1,t]
>
>y[2,t] = alpha[2,0] + beta[2,2, 
>1]*y[2,t-1]+............+beta[2,2, 12]*y[2,t-12] + e[2,t]
>
>y[3,t] = alpha[3,0] + beta[3,1, 
>1]*y[1,t-1]+............+beta[3,1, 12]*y[1,t-12] 
>+ beta[3,2, 1]*y[2,t-1]+............+beta[3,2, 12]*y[2,t-12]
>+ beta[3,3, 1]*y[3,t-1]+............+beta[3,3, 12]*y[3,t-12]
>+ beta[3,4, 1]*y[4,t-1]+............+beta[3,4, 12]*y[4,t-12] + e[3,t]
>
>y[4,t] = alpha[4,0] + beta[4,3, 
>1]*y[3,t-1]+............+beta[4,3, 12]*y[3,t-12] 
>+ beta[4,4, 1]*y[4,t-1]+............+beta[4,4, 12]*y[4,t-12] + e[4,t]
>
>y[5,t] = alpha[5,0] + beta[5,3, 
>1]*y[3,t-1]+............+beta[5,3, 12]*y[3,t-12] 
>+ beta[5,5, 1]*y[5,t-1]+............+beta[5,5, 12]*y[4,t-12] + e[5,t]
>
>All variables are stationary
>
>Now I want to estimate the coefficients under a VAR[12] 
>framework. Is it mathematically correct to estimate 
>coefficients of each equaltion with simple OLS separately? Or 
>how I can use R [mAr.est() function) to estimate them?
>   
>  Regards,
>
>
>       
>---------------------------------
>
>	[[alternative HTML version deleted]]
>
>______________________________________________
>R-help at stat.math.ethz.ch 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.
>
*****************************************************************
Confidentiality Note: The information contained in this mess...{{dropped}}



------------------------------

Message: 37
Date: Mon, 20 Aug 2007 10:00:51 +0200
From: Uwe Ligges <ligges at statistik.uni-dortmund.de>
Subject: Re: [R] Differentiation
To: Shubha Vishwanath Karanth <shubhak at ambaresearch.com>
Cc: r-help at stat.math.ethz.ch
Message-ID: <46C94A33.8050304 at statistik.uni-dortmund.de>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed



Shubha Vishwanath Karanth wrote:
> Hi,
> 
>  
> 
> Could anyone tell me what is the command used in R to do 
> 
> 1.	Differentiation

See ?deriv and note that R is numerical software and only has limited 
capabilities for symbolic mathematics such as differentiation.


> 2.	Newton Raphson method (Numerical Analysis in general...)

For numerical optimization see ?optim which implements several methods.

Uwe Ligges



>  
> 
> Are there any packages separately for this?
> 
>  
> 
[[replacing trailing spam]]
> 
>  
> 
> BR, Shubha
> 
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at stat.math.ethz.ch 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.



------------------------------

Message: 38
Date: Mon, 20 Aug 2007 01:17:02 -0700 (PDT)
From: squall44 <tobias.minder at bluewin.ch>
Subject: [R] Question about writing some code
To: r-help at stat.math.ethz.ch
Message-ID: <12231853.post at talk.nabble.com>
Content-Type: text/plain; charset=us-ascii


Just a short question:
Why does this work:

x = c(1.6,1.8,2.4,2.7,2.9,3.3,3.4,3.4,4,5.2)
F26<-boxplot(x,
        add=FALSE,
        horizontal=TRUE,
        main="Figur 2.6 Boxplot",
        axes=FALSE)

...but this doesn't...

x = c(1.6,1.8,2.4,2.7,2.9,3.3,3.4,3.4,4,5.2)
F26 <- boxplot(x)
plot(F26,
        add=FALSE,
        horizontal=TRUE,
        main="Figur 2.6 Boxplot",
        axes=FALSE)

Thanks for any help,
Squall44
-- 
View this message in context:
http://www.nabble.com/Question-about-writing-some-code-tf4297359.html#a12231
853
Sent from the R help mailing list archive at Nabble.com.



------------------------------

Message: 39
Date: Mon, 20 Aug 2007 10:46:50 +0200
From: Georg Otto <georg.otto at tuebingen.mpg.de>
Subject: Re: [R] Building Packages with AnnBuilder
To: r-help at stat.math.ethz.ch
Message-ID: <m1tzqud24l.fsf at tuebingen.mpg.de>
Content-Type: text/plain; charset=us-ascii

"jakob bleier" <chimaere47 at hotmail.com> writes:

> I got some Problems building an Annotation-Package with AnnBuilder.
> Not using the function ABPkgBuilder(), but just parts of it to create a 
> package without connecting to the servers, I managed to create a Package, 
> but it seems to be empty. R recognizes it as a package, but is unable to 
> load it.

Hi,

I think this question is better directed to the bioconductor mailing
list, since AnnBuilder is a bioconductor package. In order to enable
people to answer your question you should also include example code
and the output of the command sessionInfo().

Best,

Georg



------------------------------

Message: 40
Date: Mon, 20 Aug 2007 11:04:34 +0200
From: Tom Willems <Tom.Willems at var.fgov.be>
Subject: [R] Q:   combine 2 data frames with missing values
To: r-help at stat.math.ethz.ch
Message-ID:
	
<OF7885BEB4.43A89D07-ONC125733D.002C9AA1-C125733D.0031E1C0 at var.fgov.be>
	
Content-Type: text/plain

hello R ussers,

i have the same problem with my data,
for aal the different variables, i have the same number of cases, but the 
are often out of detectionlimits so they produce "na's" .
so the data looks like this:

case    var1    var2    var3    var4 ... 
1       9       9       13      11
2       15      9       15      13 
3       na      na      12      9
4       8       6       na      na
5       14      10      na      na
6       20      15      17      15      ..
..

What i would like to do for data exploration, is to compare each possible 
pair of variables, get their correlation coefficient, the intercept and 
the slope of regression line. yet for every variable the messurements are 
lnked thruogh theyr case. it is the same sample just a diferent test.

Now  i select a subsets  of variables out of the original dataset, and use 
 : 
          value_x1 = subset(dataset_1,select=lg_value)
          value_y1 =subset(dataset_2,select=lg_value)

Then i to mold an lm model, inorder to get estimates for the slope ans 
intercept
        model_1 <- lm (value_y1[,1]~ value_x1[,1]  )

This is what R tell's me:
                        "Error in model.frame(formula, rownames, 
variables, varnames, extras, extranames,  : 
                                  variable lengths differ (found for 
'value_x1[, 1]')"

Is there perhapes a way of binding the selected subsets together, still 
linked to their case, so that the na's can be discarded by R automaticaly?
I have been trying to use SQLiteDF and the other sql func's of R, but i 
don't realy understand them.
If someone out there knows how to use sql, in R, i d be delited if he or 
she could explain it to me, more understandible then the manuals i find on 
the web.
Here is what io would want sql to do .


My data is in columns, one column holds all the case numbers, one the 
messured values, one all the testtypes and one the timeperiod and then one 
column for the lab's that preformed the test. is is stored in a txt file. 
So it is a long 5 column data table.
Now is it possible to make a cross table holding the case nr's, and 
timeperiod in 2 column's, and then have a different column for every test?
so if there are 4 tests and 4 lab's, it would give 16 columns.
I've tryed it in access, but it gave me andless loops of repeated values. 
and creating new data files is dangerous, 'litle mistakes made while 
copying ' or manipultaions made to one file and not to the other'.
.

kind regards,
Tom



Disclaimer: click here
	[[alternative HTML version deleted]]



------------------------------

Message: 41
Date: Mon, 20 Aug 2007 10:05:24 +0100 (BST)
From: nalluri pratap <pratap_stat at yahoo.co.in>
Subject: Re: [R] Differentiation
To: Shubha Vishwanath Karanth <shubhak at ambaresearch.com>,
	r-help at stat.math.ethz.ch
Message-ID: <569019.3104.qm at web8610.mail.in.yahoo.com>
Content-Type: text/plain

try 
   
  library(numDeriv)
?genD
   
  Pratap
  
Shubha Vishwanath Karanth <shubhak at ambaresearch.com> wrote:
  Hi,



Could anyone tell me what is the command used in R to do 

1. Differentiation
2. Newton Raphson method (Numerical Analysis in general...)



Are there any packages separately for this?



[[replacing trailing spam]]



BR, Shubha


[[alternative HTML version deleted]]

______________________________________________
R-help at stat.math.ethz.ch 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.


       
---------------------------------

	[[alternative HTML version deleted]]



------------------------------

Message: 42
Date: Mon, 20 Aug 2007 11:21:23 +0200
From: Uwe Ligges <ligges at statistik.uni-dortmund.de>
Subject: Re: [R] Labelling certain points on the x-axis
To: squall44 <tobias.minder at bluewin.ch>
Cc: r-help at stat.math.ethz.ch
Message-ID: <46C95D13.3050702 at statistik.uni-dortmund.de>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed



squall44 wrote:
> Hello,
> 
> I created an empirical distribution function:
> 
> x = c(1.6,1.8,2.4,2.7,2.9,3.3,3.4,3.4,4,5.2)
> F2.5 <- ecdf(x)
> plot(F2.5, 
>      verticals= TRUE, 
>      do.p = TRUE, 
>      lwd=3, 
>      ylab = "f(x)", 
>      xlab = "x", 
>      main = "Figur 2.5 Empirische Verteilfunktion", 
>      xlim = c(1,5.5))
> abline(h= (0:5)*0.2)

See ?mtext for adding text into the margins.

Uwe Ligges



> Now I would like to label the points on the x-axis where there is an
> x-value:
> 
> http://www.nabble.com/file/p12231344/figur.gif 
> 
> I don't know how to do that... can anyone help me?
> Thanks



------------------------------

Message: 43
Date: Mon, 20 Aug 2007 11:22:49 +0200
From: Uwe Ligges <ligges at statistik.uni-dortmund.de>
Subject: Re: [R] Question about writing some code
To: squall44 <tobias.minder at bluewin.ch>
Cc: r-help at stat.math.ethz.ch
Message-ID: <46C95D69.30804 at statistik.uni-dortmund.de>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed



squall44 wrote:
> Just a short question:
> Why does this work:
> 
> x = c(1.6,1.8,2.4,2.7,2.9,3.3,3.4,3.4,4,5.2)
> F26<-boxplot(x,
>         add=FALSE,
>         horizontal=TRUE,
>         main="Figur 2.6 Boxplot",
>         axes=FALSE)


boxplot returns some information on the boxplot, but the result cannot 
be plotted by boxplot itself. You can use bxp() to do so.

Uwe Ligges



> ...but this doesn't...
> 
> x = c(1.6,1.8,2.4,2.7,2.9,3.3,3.4,3.4,4,5.2)
> F26 <- boxplot(x)
> plot(F26,
>         add=FALSE,
>         horizontal=TRUE,
>         main="Figur 2.6 Boxplot",
>         axes=FALSE)
> 
> Thanks for any help,
> Squall44



------------------------------

Message: 44
Date: Mon, 20 Aug 2007 10:26:31 +0100
From: "Paul Smith" <phhs80 at gmail.com>
Subject: Re: [R] Differentiation
To: r-help <r-help at stat.math.ethz.ch>
Message-ID:
	<6ade6f6c0708200226q3eeab103j3ab9b2856a01c70 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

On 8/20/07, nalluri pratap <pratap_stat at yahoo.co.in> wrote:
> try
>
>   library(numDeriv)
> ?genD
>
>   Pratap
>
> Shubha Vishwanath Karanth <shubhak at ambaresearch.com> wrote:
>   Hi,
>
>
>
> Could anyone tell me what is the command used in R to do
>
> 1. Differentiation
> 2. Newton Raphson method (Numerical Analysis in general...)
>
>
>
> Are there any packages separately for this?

In addition, you can use Ryacas:

?Ryacas (google code name ryacas) is an R package that allows R users
to access the yacas computer algebra system from within R. It can be
used for computer algebra, exact arithmetic, ASCII pretty printing and
R to TeX output.?

Paul



------------------------------

_______________________________________________
R-help at stat.math.ethz.ch 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.

End of R-help Digest, Vol 54, Issue 20
**************************************

No virus found in this incoming message.


07:27
 




17:44



More information about the R-help mailing list