Re: [R] Mac woes

2009-01-08 Thread Prof Brian Ripley

On Thu, 8 Jan 2009, Stuart Vyse wrote:


I am new to R but have spent a little time messing around with it. I
am running version 2.8.1 under Leopard OS 10.5 on a power PC and also
on my laptop, which is Intel. Unless, I am wrong, this version is just
a bit buggy.

1. In the R Commander, there is no direct entry of data. The Edit menu
does not include a "New data set" choice, as advertised in the Windows
version.

2. Entering data from a text file is not always trouble free.
Variables do not always seem to be understood as variables.
Scatterplot and Matrix scatterplot options under Graph are grayed out
when they shouldn't be.

3. Finally, attempting to edit your imported data file (by clicking
the "Edit data set") does open an editor window, but clicking around
in it to delete variables, etc, invariably leads to the program
hanging. The spinning beach ball.

Am I missing something? Any suggestions?


Are you talking about Rcmdr only?  That is contributed software, so it 
is unfair to blame 'R" for it (and not to give credit to John Fox for it).


There is a specific list for R on Macs, R-sig-Mac -- see the posting 
guide.  Mac issues do tend to get overlooked on this very busy general 
list, and you weere asked in the posting guide to 'discuss possible bugs' 
there.


One short answer is that Rcmdr is a Tcl/Tk program, and Tcl/Tk does not 
work particularly well on your minority platform.  But detailed, 
reproducible reports to the author (John Fox for Rcmdr) or the appropriate 
list (R-sig-mac) will help to improve the workarounds.  And I know John 
bought a Mac to help support Mac users and is unfailingly helpful to users 
of his software.



Stuart Vyse
Professor
Box 5621  web: http://www.stuartvyse.com
Department of PsychologyPhone: 860-439-2339
Connecticut College   FAX 860-439-5300
New London, CT 06320 email:  stuart.v...@conncoll.edu



--
Brian D. Ripley,  rip...@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, UKFax:  +44 1865 272595

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] longtable example

2009-01-08 Thread Dieter Menne
Felipe Carrillo  yahoo.com> writes:

> 
> Could someone try to run this example? I can't make it work.

It would be better if you would show a complete sample; the error could be 
in the header part, and chances are better to get a reply when other do 
not have to guess what to add.

>  \begin{small}
>  \setlongtables
>  \begin{longtable}{
>  <>=
>  cat(paste(c('c', rep('cc', 34/2-1), 'c'), collapse='@{\hspace{2pt}}'))
>  @ 
>  }
>  \hline


The { after \begin{longtable} looks suspicious.

Dieter

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] shake rattle() and roll

2009-01-08 Thread Dr Eberhard W Lisse

Graham,

nice package this :-)-O.

It was easy to set up MySQL but I struggled immensely to get the stock
ODBC working with PostgreSQL (8.3), which has been discussed on the
mailing list before (Prof Brian):

Warning messages:
1: In odbcDriverConnect(st, ...) :
 [RODBC] ERROR: Could not SQLDriverConnect
2: In odbcDriverConnect(st, ...) : ODBC connection failed

aka (DBD::ODBC in Perl)

Missing server name, port, or database name in call to CC_connect.  
(SQL-IM002)


aka (iodbctest)

SQLDriverConnectW = Unknown connect option (Set) (205) SQLSTATE=S1009

Figured it out, though:

Leopard comes with iODBC installed, and many people install unixODBC  
additionally.
Then then configure /sw/etc/odbc*.ini and unixODBC works, but iODBC  
doesn't.
Even if you symlink the INI files to /Library/ODBC it doesn't work.  
Even if you
remove theunixODBC installation and only use the /Library/ODBC/ 
odbc*.ini files
it doesn't work. Even if you copy libodbcpsql.so and libodbcpsqlS.so  
from
/sw/lib/ to /usr/local/lib/ and then remove unixODBC (through fink) it  
doesn't

work.

However, if you leave the two libs in /usr/local/lib after removel of  
unixODBC
install the libiodbc/libiodbc-shlibs packages from fink, and then  
symlink the

ini files to /sw/etc, it *DOES* work.

Leading me to suspect the version of iODBC that comes with 10.5.5 (and  
earlier)
is broken. Since Google is my friend I know that the CC_connect issue  
is also

prevalent on linux so I reckon it's not Mac specific.

All in all this is extremely cool, because I will have to use a  
firebird database
for my practice management software which doesn't have a direct R  
driver but now
I am confident will be able to use it (with the Read Only option :-)- 
O) to analyse

my ICD and Procedure Codes :-)-O


Three Requests for Features for rattle(): would it not be nice to also  
have direct
PostgreSQL (RdbiPgSQL) and MySQL (RMySQL) support and support for a  
SELECT statement?
In other words, sometimes the database tables directly don't give you  
what you need

and so you have to develop a (convoluted) SQL statement first.

Would be nice if one could ratlle(convolutedSQL) :-)-O

greetings, el
--
Dr. Eberhard W. Lisse   \/  Managing Member, |Ondis (cc)
accou...@ondis.co.na/ * | Telephone: +264 81 124 6733 (cell)
PO Box 98256 \ /Please do NOT send e-mail to e...@lisse.na
Windhoek Namibia ;/   if it is in ANY way DNS/|Ondis related




--
Dr. Eberhard W. Lisse  \/ Obstetrician & Gynaecologist (Saar)
e...@lisse.na el108-ARIN /   *   |   Telephone: +264 81 124 6733 (cell)
PO Box 8421 \ / Please send DNS/NA-NiC related e-mail
Bachbrecht, Namibia ;/ to dns-ad...@na-nic.com.na

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] AT&T Researchers and the New York Times

2009-01-08 Thread Dr Eberhard W Lisse

Robert,

go ahead, fix whatever bothers you, this is Open Sauce, not Jet-Engine  
Science

:-)-O

el

On 09 Jan 2009, at 07:41 , Johannes Huesing wrote:

stephen sefick  [Fri, Jan 09, 2009 at 03:16:11AM  
CET]:

It has worked wonders for me over the last years.


On Thu, Jan 8, 2009 at 8:58 PM, Robert Wilkins  
 wrote:

And by the way, ARE YOU GUYS EVER GOING TO FIX your mailing list
platform? It is extremely user-unfriendly and a technological clunk.


He possibly means the Web interface to the archive, which I am not  
bothered

about since the list is mirrored on Gmane.

--
Johannes Hüsing


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Mac woes

2009-01-08 Thread John Fox
Dear Stuart,

> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On
> Behalf Of Stuart Vyse
> Sent: January-08-09 10:41 PM
> To: r-help@r-project.org
> Subject: [R] Mac woes
> 
> I am new to R but have spent a little time messing around with it. I
> am running version 2.8.1 under Leopard OS 10.5 on a power PC and also
> on my laptop, which is Intel. Unless, I am wrong, this version is just
> a bit buggy.
> 
> 1. In the R Commander, there is no direct entry of data. The Edit menu
> does not include a "New data set" choice, as advertised in the Windows
> version.

First, you shouldn't necessarily blame R for failings of the R Commander,
since it is a contributed package and not part of the base system. In this
case, however, the "New data set" menu item is absent under Mac OS X because
the data editor hangs on an empty data frame -- at least when I tried it.

> 
> 2. Entering data from a text file is not always trouble free.
> Variables do not always seem to be understood as variables.

It's not possible to know what the source of the difficulty is without the
files that are causing problems. I suspect that the data files aren't
properly prepared. Can you provide an example?

> Scatterplot and Matrix scatterplot options under Graph are grayed out
> when they shouldn't be.

The scatterplot menu item is grayed out if there are fewer than two
numerical variables in the active data set; the scatterplot-matrix item is
grayed out if there are fewer than three numerical variables. That seems
sensible to me, but again, without the data, it's not possible to know
whether the Rcmdr is behaving incorrectly or whether you want it to do
something that it considers unreasonable, such as making a scatterplot for
categorical variables.

> 
> 3. Finally, attempting to edit your imported data file (by clicking
> the "Edit data set") does open an editor window, but clicking around
> in it to delete variables, etc, invariably leads to the program
> hanging. The spinning beach ball.

Here, the Rcmdr invokes the R data editor, and I've encountered problems
similar to those that you describe with the data editor on the Mac, both
when called from the Rcmdr and from the R command prompt. For example, if I
load just the car package and edit(Prestige), adding variables and rows, and
deleting variables and rows, eventually I can make R hang or, on exit,
produce an error. I'm running R 2.8.1 under Mac OS X 10.5.5. Perhaps I
should suppress the edit button as well.

> 
> Am I missing something? Any suggestions?

Yes, be more specific about what produces the problems you're experiencing.

Regards,
 John

> 
> SV
> 
> Stuart Vyse
> Professor
> Box 5621  web:
http://www.stuartvyse.com
> Department of PsychologyPhone: 860-439-2339
> Connecticut College   FAX 860-439-5300
> New London, CT 06320 email:  stuart.v...@conncoll.edu
> 
> 
> 
> 
> 
> 
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] AT&T Researchers and the New York Times

2009-01-08 Thread Johannes Huesing
stephen sefick  [Fri, Jan 09, 2009 at 03:16:11AM CET]:
> It has worked wonders for me over the last years.  

> On Thu, Jan 8, 2009 at 8:58 PM, Robert Wilkins  wrote:
> > And by the way, ARE YOU GUYS EVER GOING TO FIX your mailing list
> > platform? It is extremely user-unfriendly and a technological clunk.

He possibly means the Web interface to the archive, which I am not bothered
about since the list is mirrored on Gmane.

-- 
Johannes Hüsing   There is something fascinating about science. 
  One gets such wholesale returns of conjecture 
mailto:johan...@huesing.name  from such a trifling investment of fact.  
  
http://derwisch.wikidot.com (Mark Twain, "Life on the Mississippi")

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Programming Question (setting ylim generally)

2009-01-08 Thread stephen sefick
library(StreamMetabolism)

day <- (structure(c(10.08, 10.08, 10.05, 10.03, 10, 9.98, 9.96, 9.95,
9.95, 9.96, 9.96, 9.98, 10.01, 10.05, 10.06, 10.09, 10.11, 10.11,
10.13, 10.13, 10.15, 10.15, 10.13, 10.14, 10.11, 10.13, 10.14,
10.13, 10.12, 10.13, 10.14, 10.16, 10.18, 10.19, 10.23, 10.27,
10.33, 10.37, 10.45, 10.57, 10.6, 10.66, 10.73, 10.77, 10.84,
10.86, 10.87, 10.94, 10.98, 11.01, 11.05, 11.09, 11.11, 11.12,
11.14, 11.13, 11.15, 11.14, 11.13, 11.13, 11.12, 11.09, 11.08,
11.07, 11.05, 11.04, 11.03, 11.01, 10.99, 11, 10.94, 10.91, 10.86,
10.82, 10.77, 10.73, 10.7, 10.63, 10.59, 10.54, 10.47, 10.37,
10.3, 10.23, 10.18, 10.13, 10.09, 10.05, 10.02, 9.98, 9.96, 9.95,
9.94, 9.93, 9.94, 9.97), index = structure(c(13600.000694,
13600.01, 13600.021528, 13600.031944, 13600.042361,
13600.052778, 13600.063194, 13600.073611, 13600.084028,
13600.09, 13600.104861, 13600.115278, 13600.125694,
13600.136111, 13600.146528, 13600.156944, 13600.167361,
13600.18, 13600.188194, 13600.198611, 13600.209028,
13600.219444, 13600.229861, 13600.240278, 13600.250694,
13600.26, 13600.271528, 13600.281944, 13600.292361,
13600.302778, 13600.313194, 13600.323611, 13600.334028,
13600.34, 13600.354861, 13600.365278, 13600.375694,
13600.386111, 13600.396528, 13600.406944, 13600.417361,
13600.427778, 13600.438194, 13600.448611, 13600.459028,
13600.469444, 13600.479861, 13600.490278, 13600.500694,
13600.51, 13600.521528, 13600.531944, 13600.542361,
13600.552778, 13600.563194, 13600.573611, 13600.584028,
13600.59, 13600.604861, 13600.615278, 13600.625694,
13600.636111, 13600.646528, 13600.656944, 13600.667361,
13600.68, 13600.688194, 13600.698611, 13600.709028,
13600.719444, 13600.729861, 13600.740278, 13600.750694,
13600.76, 13600.771528, 13600.781944, 13600.792361,
13600.802778, 13600.813194, 13600.823611, 13600.834028,
13600.84, 13600.854861, 13600.865278, 13600.875694,
13600.886111, 13600.896528, 13600.906944, 13600.917361,
13600.927778, 13600.938194, 13600.948611, 13600.959028,
13600.969444, 13600.979861, 13600.990278), format =
structure(c("m/d/y",
"h:m:s"), .Names = c("dates", "times")), origin = structure(c(1,
1, 1970), .Names = c("month", "day", "year")), class = c("chron",
"dates", "times")), class = "zoo"))

plot.e <- function(b, w, x, y, z){
a <- window.chron(b, w, x, y, z)
low <- min(b*0.98)+5
high <- max(b*1.02)+5
plot(a, ylim=c(low, high))
lines(a*0.98, col="blue")
lines(a*1.02, col="red")
}

plot.e(day, "03/28/2007", "00:00:00", "03/28/2007", "23:46:00")

why do the low and high objects not set the ylim of the plotting function?

thanks

-- 
Stephen Sefick

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods.  We are mammals, and have not exhausted the
annoying little problems of being mammals.

-K. Mullis

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] VCOV Source Code

2009-01-08 Thread Henrik Bengtsson
> stats::vcov.lm
Error: 'vcov.lm' is not an exported object from 'namespace:stats'

> stats:::vcov.lm
function (object, ...)
{
so <- summary.lm(object, corr = FALSE)
so$sigma^2 * so$cov.unscaled
}


/Henrik

On Thu, Jan 8, 2009 at 1:44 AM, Carlos J. Gil Bellosta
 wrote:
> Hello,
>
> You can do
>
> stats:::vcov.lm
>
> to see the source code for that particular method. In order to see which
> are the methods supported by vcov, write
>
> methods("vcov")
>
> Best regards,
>
> Carlos J. Gil Bellosta
> http://www.datanalytics.com
>
>
> On Wed, 2009-01-07 at 21:37 -0600, Yang Wan wrote:
>> Dear R Help,
>>
>>
>>
>> I wonder the way to show the source code of [vcov] command.  Usually, it
>> can show the source code after input the command and enter. But for
>> [vcov], it shows
>>
>>
>>
>> function (object, ...)
>>
>> UseMethod("vcov")
>>
>> 
>>
>>
>>
>> I appreciate for your help.  Best wishes.
>>
>>
>>
>> Christina
>>
>>
>>   [[alternative HTML version deleted]]
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] VCOV Source Code

2009-01-08 Thread Murray Cooper

Mostly I am interested in using R for statistics.
I am also interested in being able to look at source code.
I hope to be able to write extensions.
I tried the suggestion below but was unable to access vcov.lm.


methods(vcov)

[1] vcov.Arima* vcov.glm*   vcov.lm*vcov.mlm*   vcov.nls*

  Non-visible functions are asterisked

stats::vcov.lm

Error: 'vcov.lm' is not an exported object from 'namespace:stats'




I am currently using version 2.7.2 on XP.

Any suggestions on how to proceed next?

Thank You,

Murray M Cooper
Richland Statistics
9800 N 24th St
Richland, MI, USA 49083
Mail: richs...@earthlink.net

- Original Message - 
From: "Carlos J. Gil Bellosta" 

To: "Yang Wan" 
Cc: 
Sent: Thursday, January 08, 2009 4:44 AM
Subject: Re: [R] VCOV Source Code



Hello,

You can do

stats:::vcov.lm

to see the source code for that particular method. In order to see which
are the methods supported by vcov, write

methods("vcov")

Best regards,

Carlos J. Gil Bellosta
http://www.datanalytics.com


On Wed, 2009-01-07 at 21:37 -0600, Yang Wan wrote:

Dear R Help,



I wonder the way to show the source code of [vcov] command.  Usually, it
can show the source code after input the command and enter. But for
[vcov], it shows



function (object, ...)

UseMethod("vcov")





I appreciate for your help.  Best wishes.



Christina


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html

and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html

and provide commented, minimal, self-contained, reproducible code.



__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Mac woes

2009-01-08 Thread Stuart Vyse
I am new to R but have spent a little time messing around with it. I  
am running version 2.8.1 under Leopard OS 10.5 on a power PC and also  
on my laptop, which is Intel. Unless, I am wrong, this version is just  
a bit buggy.

1. In the R Commander, there is no direct entry of data. The Edit menu  
does not include a "New data set" choice, as advertised in the Windows  
version.

2. Entering data from a text file is not always trouble free.  
Variables do not always seem to be understood as variables.  
Scatterplot and Matrix scatterplot options under Graph are grayed out  
when they shouldn't be.

3. Finally, attempting to edit your imported data file (by clicking  
the "Edit data set") does open an editor window, but clicking around  
in it to delete variables, etc, invariably leads to the program  
hanging. The spinning beach ball.

Am I missing something? Any suggestions?

SV

Stuart Vyse
Professor
Box 5621  web: http://www.stuartvyse.com
Department of PsychologyPhone: 860-439-2339
Connecticut College   FAX 860-439-5300
New London, CT 06320 email:  stuart.v...@conncoll.edu







[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] survey statistics, rate/proportions with standard errors

2009-01-08 Thread Stas Kolenikov
On 1/8/09, Robert Wilkins  wrote:
> what does R have to compare with , say , proc surveymeans, estimate survey
>  means/proportions with standard errors, using Taylor methods?

survey package by Thomas Lumley has pretty much everything you would
need. Way more than SAS, at any rate. There are means, totals, ratios,
as well as regression/GLM estimation procedures using Taylor series,
jackknife, and the bootstrap. Try

install.packages("survey")

-- 
Stas Kolenikov, also found at http://stas.kolenikov.name
Small print: I use this email account for mailing lists only.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Problem with aovlmer.fnc in languageR

2009-01-08 Thread Chuck Clifton

I have been corresponding with Harald Baayen about this problem, and it
appears that something is broken with the mcmcsamp function that pvals.fnc
calls. Running pvals.fnc on an lmer object actually changes the contents of
the object (get a summary before and after running pvals.fnc and you'll see)
in a way that triggers this error message. Douglas Bates has been notified;
one can hope that the problem will be fixed in a future release of lme4.


Dear R list,

I have a recurring problem with the languageR package, specifically the 
aovlmer.fnc function. When I try to run the following code (from R. H. 
Baayen's textbook):


 # Example 1:
 library(languageR)
 latinsquare.lmer <- lmer(RT ~ SOA + (1 | Word) + (1 | Subject),
  data = latinsquare)
 x <- pvals.fnc(latinsquare.lmer,
withMCMC = TRUE)
 aovlmer.fnc(latinsquare.lmer,
 mcmc = x$mcmc,
 which = c("SOAmedium", "SOAshort"))


I get the following error message (German locale):


 Fehler in anova(object) : Calculated PWRSS for a LMM is negative



-- 
View this message in context: 
http://www.nabble.com/Problem-with-aovlmer.fnc-in-languageR-tp20706128p21365322.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Extracting File Basename without Extension

2009-01-08 Thread jim holtman
You can use 'sub' to get rid of the extensions:

> sub("^([^.]*).*", "\\1", 'filename.extension')
[1] "filename"
> sub("^([^.]*).*", "\\1", 'filename.extension.and.more')
[1] "filename"
> sub("^([^.]*).*", "\\1", 'filename without extension')
[1] "filename without extension"


On Thu, Jan 8, 2009 at 9:10 PM, Gundala Viswanath  wrote:
> Dear all,
>
> The basename() function returns the extension also:
>
>> myfile <- "path1/path2/myoutput.txt"
>> basename(myfile)
> [1] "myoutput.txt"
>
>
> Is there any other function where it just returns
> plain base:
>
> "myoutput"
>
> i.e. without 'txt'
>
> - Gundala Viswanath
> Jakarta - Indonesia
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



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

What is the problem that you are trying to solve?

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] AT&T Researchers and the New York Times

2009-01-08 Thread stephen sefick
It has worked wonders for me over the last years.  It clunkily and
reliably delivers messages to my inbox that are either someone elses
question about R or an answer to one of my questions.
clunkily yours

Stephen Sefick

On Thu, Jan 8, 2009 at 8:58 PM, Robert Wilkins  wrote:
> Is anyone in the leadership of the R-project going to contact the New
> York Times and clarify that the article gave remarkably short shrift
> to the people who designed the user interface for R, to a large extent
> AT&T researchers from an earlier generation? It would be the
> appropriate thing to do.
>
> The R team did not develop the user interface for R, the designers of
> the S programming language did. The layman reader of Vance's article
> will get the impression that R is a brand new invention, which is
> misleading and unfair. Gentleman and Ihaka should try harder to give
> credit where credit is due.
>
>
> And by the way, ARE YOU GUYS EVER GOING TO FIX your mailing list
> platform? It is extremely user-unfriendly and a technological clunk.
> The mailing lists for SAS, Python , and others (UseNet) may not be a
> user-interface-work-of-genius, but they are far superior to the R
> mailing list. What a clunk.
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Stephen Sefick

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods.  We are mammals, and have not exhausted the
annoying little problems of being mammals.

-K. Mullis

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Extracting File Basename without Extension

2009-01-08 Thread Gundala Viswanath
Dear all,

The basename() function returns the extension also:

> myfile <- "path1/path2/myoutput.txt"
> basename(myfile)
[1] "myoutput.txt"


Is there any other function where it just returns
plain base:

"myoutput"

i.e. without 'txt'

- Gundala Viswanath
Jakarta - Indonesia

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] What does R have for age-adjusted survey analysis?

2009-01-08 Thread Robert Wilkins
A procedure that , after adjusting for sampling weights, also
explicitly does an age adjustment to conform with an age distribution
of an older census?

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] survey statistics, rate/proportions with standard errors

2009-01-08 Thread Robert Wilkins
what does R have to compare with , say , proc surveymeans, estimate survey
means/proportions with standard errors, using Taylor methods?

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Creating file names.

2009-01-08 Thread Tony Breyal
Hi, if i understood correctly, you probably want the something like:

## R
format(Sys.time(), "LMSMOD_%b_%d_%y_%H%M")

(works on windows, don't know about Mac)

Hope that helps a little,
Tony Breyal


On 8 Jan, 23:47, greggal...@gmail.com wrote:
> I have a function that is called from a "sourced" script, whenever
> certain conditions are met.
>
> I have this inside it:  if(P > 0.9)save( file = today() , myLMSmodel );
>
> This gives me files that look like this: Thu Jan  8 14:04:43 2009
>
> That works fine on my Mac, but it would be much more convenient to
> have something like this:
>
> LMSMOD_Jan_08_09_1404
>
> Does anyone know how I can do this?
>
> (You don't have to put in the underscores, if it's too much work.)
>
> Thanks,
>
> Gregg Allen
>
> __
> r-h...@r-project.org mailing listhttps://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Using apply for two datasets

2009-01-08 Thread Christos Argyropoulos

It depends on how the data are arranged

##
x<-matrix(c(1,2,3,2,8,2,4,5,6),nrow=3)
y<-matrix(c(10,2,13,0,8,4,4.2,5.2,6.2),nrow=3)

q<-mapply(t.test,as.data.frame(x),as.data.frame(y))

q

## The ith column of q contain the results of applying t.test to 
## the ith column of x and the jth column of y
##

Since the t.test returns a list, you can wrap it in your own function if 
you want to process the data in an assembly line fashion.

Continuing the previous example:

my.t<-function(x,y,...) { c(t.test(x,y,...))[1:3] }

q2<-mapply(my.t,as.data.frame(x),as.data.frame(y))

q2


Good luck!

Christos Argyropoulos
University of Pittsburgh Medical Center

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] AT&T Researchers and the New York Times

2009-01-08 Thread Robert Wilkins
Is anyone in the leadership of the R-project going to contact the New
York Times and clarify that the article gave remarkably short shrift
to the people who designed the user interface for R, to a large extent
AT&T researchers from an earlier generation? It would be the
appropriate thing to do.

The R team did not develop the user interface for R, the designers of
the S programming language did. The layman reader of Vance's article
will get the impression that R is a brand new invention, which is
misleading and unfair. Gentleman and Ihaka should try harder to give
credit where credit is due.


And by the way, ARE YOU GUYS EVER GOING TO FIX your mailing list
platform? It is extremely user-unfriendly and a technological clunk.
The mailing lists for SAS, Python , and others (UseNet) may not be a
user-interface-work-of-genius, but they are far superior to the R
mailing list. What a clunk.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] The AT&T researchers and the New York Times

2009-01-08 Thread Robert Wilkins
Is anyone in the leadership of the R-project going to contact the New York
Times and clarify that the article gave remarkably short shrift to the
people who designed the user interface for R, to a large extent AT&T
researchers from an earlier generation? It would be the appropriate thing to
do.

The R team did not develop the user interface for R, the designers of the S
programming language did. The layman reader of Vance's article will get the
impression that R is a brand new invention, which is misleading and unfair.
Gentleman and Ihaka should try harder to give credit where credit is due.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Creating file names.

2009-01-08 Thread Don MacQueen

Your easiest starting point is probably

  file = format(Sys.time())

and then look at the online help for the strptime function to learn 
about formatting options.


For example
  format( Sys.time() , '%m%d%y' )

Use paste() and some formatting of Sys.time() to construct the form 
you are looking for.


-Don

At 4:47 PM -0700 1/8/09, greggal...@gmail.com wrote:

I have a function that is called from a "sourced" script, whenever
certain conditions are met.

I have this inside it:  if(P > 0.9)save( file = today() , myLMSmodel );


This gives me files that look like this: Thu Jan  8 14:04:43 2009

That works fine on my Mac, but it would be much more convenient to
have something like this:

LMSMOD_Jan_08_09_1404


Does anyone know how I can do this?

(You don't have to put in the underscores, if it's too much work.)

Thanks,


Gregg Allen

__
R-help@r-project.org mailing list
https:// stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http:// www. R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



--
--
Don MacQueen
Environmental Protection Department
Lawrence Livermore National Laboratory
Livermore, CA, USA
925-423-1062

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Graph Script/X-axis label Problem

2009-01-08 Thread jimdare

Hi,  I created the script below to plot multiple graphs.  It seems to work
pretty well (see BYX7) except when the max value for catch or TACC is very
small.  In this case the x-axis labels are removed from the x-axis (see
BYX10).  I can't figure out why given that y co-ordinate for the text
function is par("usr")[1] - 0.  Shouldn't this mean that it is flush to the
x-axis?  Can anyone see what is going wrong?  

SCRIPT:

fish<-read.csv(file="C:/Documents and Settings/darej/My
Documents/James/R/fishmany.csv",sep=",",head=T)

x.sp <- split(fish, list(fish$Species, fish$Stock)) 

for (i in x.sp){

par(mar = c(7, 6, 4, 2) + 0.1)
yaxmax=(max(i$TACC, i$Catch))*1.2
mp <- barplot(i$TACC, xaxt="n",
main=paste(i$Stock[1]),space=0,xlab="",ylab="",ylim=c(0,max(i$TACC,
i$Catch))*1.2)

axis(1, labels = FALSE)
labels <- paste(i$Year, sep = " ")
text(mp, par("usr")[1] - 0, srt = 45, cex=0.75,adj = 1,
 labels = labels, xpd = TRUE)

lines(mp, i$Catch, type='o', pch=18,lwd=2)
legend("topright",legend=
c("TACC","Catch"),bty="n",col=c("black","black"),lty=c(0,1),lwd=c(0,2), 
pch=c(22,18),pt.bg=c("grey",NA),pt.cex=2)
xmax=length(i$Year)
text(xmax*0.6, par("usr")[1] - (0.1*yaxmax), srt = 0, adj = 1,
 labels = "Fishing Year", xpd = TRUE,cex=1.2)

text(xmax*-0.15, par("usr")[1] + (0.6*yaxmax), srt = 90, adj = 1,
 labels = "Tonnes", xpd = TRUE,cex=1.2)

savePlot(filename=paste(i$Stock[1]),type="wmf")
}  

http://www.nabble.com/file/p21364546/BYX7.gif 
http://www.nabble.com/file/p21364546/BYX10.gif 
-- 
View this message in context: 
http://www.nabble.com/Graph-Script-X-axis-label-Problem-tp21364546p21364546.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Creating file names.

2009-01-08 Thread Peter Alspach
Gregg

You could either manipulate the character returned by today(), or try
using Sys.time() instead.  For example, on Windows,

paste(strsplit(date(), ' ')[[1]][c(2,3,5,4)], collapse='_')

gives

Jan_09_2009_13:40:57

which approaches what you want.  Alternatively

format(Sys.time(), "%b_%d_%y_%H%M")

gives

Jan_09_09_1342

which only needs LMSMOD pasted to the front which sep='_'.

HTH ...

Peter Alspach

> -Original Message-
> From: r-help-boun...@r-project.org 
> [mailto:r-help-boun...@r-project.org] On Behalf Of 
> greggal...@gmail.com
> Sent: Friday, 9 January 2009 12:47 p.m.
> To: r-help@r-project.org
> Subject: [R] Creating file names.
> 
> I have a function that is called from a "sourced" script, 
> whenever certain conditions are met.
> 
> I have this inside it:  if(P > 0.9)save( file = today() , 
> myLMSmodel );
> 
> 
> This gives me files that look like this: Thu Jan  8 14:04:43 2009
> 
> That works fine on my Mac, but it would be much more 
> convenient to have something like this:
> 
> LMSMOD_Jan_08_09_1404
> 
> 
> Does anyone know how I can do this?
> 
> (You don't have to put in the underscores, if it's too much work.)
> 
> Thanks,
> 
> 
> Gregg Allen
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 

The contents of this e-mail are confidential and may be subject to legal 
privilege.
 If you are not the intended recipient you must not use, disseminate, 
distribute or
 reproduce all or any part of this e-mail or attachments.  If you have received 
this
 e-mail in error, please notify the sender and delete all material pertaining 
to this
 e-mail.  Any opinion or views expressed in this e-mail are those of the 
individual
 sender and may not represent those of The New Zealand Institute for Plant and
 Food Research Limited.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] help

2009-01-08 Thread Duncan Mackay

Unfortunately a little long

Try this (I have used Miktex 2.7 on win XP and R 2.8 for this)
I have not gone into the detail of the first chunk I just created the 
header strings in R and copied to make the Sweave file lines

With a little thought it can be done I suppose

## Sweave script
\documentclass[10pt,a4paper,landscape]{article}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage{times}
\usepackage[left=0.5in,right=0.5in,top=1.0in,bottom=1.0in,includefoot]{geometry}
\usepackage{dcolumn}
\usepackage{booktabs}
\usepackage{longtable}

\setlength{\parindent}{0pt}

% BEGIN DOCUMENT
\begin{document}

\begin{small}
\begin{longtable}[34]{rr}
% if want different first 1
\toprule
\addlinespace[5pt]
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 
18 & 19 & 20 & 21 & 22 & 23 & 24 & 25 & 26 & 27 & 28 & 29 & 30 & 31 & 32 & 
33 & 34 \\

\addlinespace[3pt]
\midrule
\addlinespace[5pt]
\endfirsthead

% all table headers (if not first different use \toprule instead on the 
next line)

\midrule
\addlinespace[5pt]
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 
18 & 19 & 20 & 21 & 22 & 23 & 24 & 25 & 26 & 27 & 28 & 29 & 30 & 31 & 32 & 
33 & 34 \\

\addlinespace[3pt]
\midrule
\addlinespace[5pt]
\endhead

% last footer
\addlinespace[5pt]
\bottomrule
\endlastfoot

% other footers
\addlinespace[5pt]
\multicolumn{33}{r}{Continued next page}\\
\addlinespace[3pt]
\midrule
\endfoot
%
<>=

  library(xtable)
  set.seed(2345)

  res <- matrix(sample(0:9, size=34*90, replace=TRUE), ncol=34, nrow=90)

  x <- apply(res,1,function(x) paste(paste(x,collapse= " & "), " \n") )

  for (j in seq_along(x) ) cat(x[j])
@

\end{longtable}
\end{small}

% END DOCUMENT
\end{document}

# end Sweave

Regards

Duncan Mackay
Department of Agronomy and Soil Science
University of New England
ARMIDALE NSW 2351
Email (home): mac...@northnet.com.au


At 06:30 9/01/2009, you wrote:

Hi:
I am going through some of the xtable examples and I can't make the one 
below work. I need to create a longtable on the fly keeping the column 
headers for all the pages and I thought this example could give some ideas 
on how to do it. I am using Sweave and xtable to create my tables and 
graphics. I wonder if someone could tell me what's wrong. Thanks


## Not run:
\begin{small}
\setlongtables
\begin{longtable}{
<>=
cat(paste(c('c', rep('cc', 34/2-1), 'c'), collapse='@{\hspace{2pt}}'))
@
}
\hline
\endhead
\hline
\endfoot
<>=
library(xtable)
set.seed(2345)
res <- matrix(sample(0:9, size=34*90, replace=TRUE), ncol=34, nrow=90)
xres <- xtable(res)
digits(xres) <- rep(0, 35)
addtorow <- list()
addtorow$pos <- list()
addtorow$pos[[1]] <- c(seq(4, 40, 5), seq(49, 85, 5))
addtorow$pos[[2]] <- 45
addtorow$command <- c('\vspace{2mm} \n', '\newpage \n')
print(xres, add.to.row=addtorow, include.rownames=FALSE, 
include.colnames=FALSE, only.contents=TRUE, hline.after=NULL)

@
\end{longtable}
\end{small}
## End(Not run)


Felipe D. Carrillo
Supervisory Fishery Biologist
Department of the Interior
US Fish & Wildlife Service
California, USA

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Creating file names.

2009-01-08 Thread greggallen
I have a function that is called from a "sourced" script, whenever
certain conditions are met.

I have this inside it:  if(P > 0.9)save( file = today() , myLMSmodel );


This gives me files that look like this: Thu Jan  8 14:04:43 2009

That works fine on my Mac, but it would be much more convenient to
have something like this:

LMSMOD_Jan_08_09_1404


Does anyone know how I can do this?

(You don't have to put in the underscores, if it's too much work.)

Thanks,


Gregg Allen

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Bar Plot with Connected Points on 1 Y-Axis

2009-01-08 Thread jimdare

Cheers Marc, it works perfectly now.  Thanks for your help!



Marc Schwartz wrote:
> 
> You can generalize the approach by using something like:
> 
> ...
>   ylim = c(0, max(DF$TACC, DF$Catch) * 1.1)
> ...
> 
> 
> That would allow you to use the max value of the two columns, multiplied
> by a fudge factor, which you can adjust as needed. In this case,
> increasing the y axis range by 10% to make room.
> 
> HTH,
> 
> Marc
> 
> on 01/07/2009 02:31 PM jimdare wrote:
>> Thanks Marc, that has helped a lot.  Say, for example, in a situation
>> where I
>> can't find out the highest value, is there any way to get R to
>> automatically
>> detect this and adjust the axis accordingly?  I am planning to do this
>> for
>> many different stocks at once and dont wan't to have to define the
>> highest
>> value for each.  I could set a standard axis value based on the max
>> values
>> of all stocks, however the detail will be lost for many of the less
>> exploited species.
>> 
>> 
>> Marc Schwartz wrote:
>>> on 01/06/2009 09:07 PM jimdare wrote:
 Hi Everyone,

 Have created a bar plot of the data below using the following code: 
 barplot(TACC,space=0,names.arg=Year).  I now want to add a series of
 connected points to represent the catch. I tried to do this using
 line(Catch) or points(Catch), however both of these commands result in
 each
 data point being aligned with the right edge of each bar.  I need them
 to
 be
 solid points in the centre of each bar, and for each point to be
 connected
 to its neighbour by a line.  Another issue I have is when the points
 exceed
 the values for the bar graph (e.g. in 2004 and 2005 catch>TACC) R seems
 to
 cut them off, I need the axis to be expanded so they can be seen.  I'm
 sure
 these are relatively simple problems but I am really stuck.  Thanks
 very
 much for all your help, it is much appreciated.

 James 

 DATA:

   Year  Species Stock TACC Catch
 1 2001ORHOR1   5000  4687
 2 2002ORHOR1   6000  3215
 3 2003ORHOR1   7000  6782
 4 2004ORHOR1   9000 1
 5 2005ORHOR1   9000 12000
>>> One key point to note is that barplot() returns the bar midpoints. This
>>> is noted in the help for barplot(). The bars are not centered on integer
>>> axis values, so you need the returned values to place additional
>>> annotation in the proper location relative to the bars.
>>>
>>> The other thing is to set the range of the y axis using the maximum
>>> value in Catch, plus some fudge, so that the plot covers both sets of
>>> data and has enough room for the additional points.
>>>
>>> Thus, presuming that your data is in a data frame called 'DF':
>>>
>>> mp <- barplot(DF$TACC, space = 0, names.arg = DF$Year,
>>>   ylim = c(0, 13000))
>>>
>>> # Now use lines() to add Catch
>>> lines(mp, DF$Catch, type = "b", pch = 19)
>>>
>>> See ?barplot, ?lines and ?points for more information.
>>>
>>> HTH,
>>>
>>> Marc Schwartz
>>>
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Bar-Plot-with-Connected-Points-on-1-Y-Axis-tp21324029p21362442.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Alignment of image plot overlay

2009-01-08 Thread Greg Snow
The updateusr function in the TeachingDemos package can be used to change the 
user coordinates of the first plot to match what you think they should before 
adding to the plot.

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of tsippel
> Sent: Thursday, January 08, 2009 3:23 PM
> To: r-help@r-project.org
> Subject: [R] Alignment of image plot overlay
> 
> 
> I'm having trouble with alignment of a trend line overlayed onto an
> image
> plot.  The two should be plotted on the same x-axis (time-series).
> However,
> the trend line begins about an inch into the image plot x-axis and ends
> about an inch off of end of the image plot.  Once I have the alignment
> sorted, I need to put a secondary y-axis on the image plot which is
> scaled
> for the trend line.  An example plot is attached.  My code follows.
> 
> tad.image(ptt.tad, dbins, interp=T, loess.interp=F, ylim=c(300,1),
> main="STM07.4", zlim=c(0,1))
> axis(4, at=c(1,2,3,4), labels=c(1,2,3,4), tick=T, las=1)
> par(new=T)
> plot(x=stm$dal, y=stm$model, ann=F, axes=F, type="l", col="black",
> lwd=2)
> 
> Ideas involving the use of par(usr=c(,,,)) haven't solved the issue,
> and
> attempting to convert the x-axis coordinates using the function
> grconvertX()
> hasn't worked either.  Using the axis function as shown here hasn't
> helped
> either.
> 
> The function above called tad.image() was written by someone else, but
> it
> calls the image() function to make the plot shown.
> 
> 
> 
> http://www.nabble.com/file/p21362251/test.plot.jpeg test.plot.jpeg
> --
> View this message in context: http://www.nabble.com/Alignment-of-image-
> plot-overlay-tp21362251p21362251.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Alignment of image plot overlay

2009-01-08 Thread tsippel

I'm having trouble with alignment of a trend line overlayed onto an image
plot.  The two should be plotted on the same x-axis (time-series).  However,
the trend line begins about an inch into the image plot x-axis and ends
about an inch off of end of the image plot.  Once I have the alignment
sorted, I need to put a secondary y-axis on the image plot which is scaled
for the trend line.  An example plot is attached.  My code follows.

tad.image(ptt.tad, dbins, interp=T, loess.interp=F, ylim=c(300,1),
main="STM07.4", zlim=c(0,1))
axis(4, at=c(1,2,3,4), labels=c(1,2,3,4), tick=T, las=1)
par(new=T)
plot(x=stm$dal, y=stm$model, ann=F, axes=F, type="l", col="black", lwd=2)  

Ideas involving the use of par(usr=c(,,,)) haven't solved the issue, and
attempting to convert the x-axis coordinates using the function grconvertX()
hasn't worked either.  Using the axis function as shown here hasn't helped
either.  

The function above called tad.image() was written by someone else, but it
calls the image() function to make the plot shown.  



http://www.nabble.com/file/p21362251/test.plot.jpeg test.plot.jpeg 
-- 
View this message in context: 
http://www.nabble.com/Alignment-of-image-plot-overlay-tp21362251p21362251.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Want to post

2009-01-08 Thread Alon Ben-Ari
Dont be so American
Cut the paper work
lets get going

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] 'equivalent' sign in plot title

2009-01-08 Thread Peter Alspach
Try

plot(1:10, main=expression(x%==%y))

For more details see

?plotmath

or

demo(plotmath) 

HTH ...

Peter Alspach

> -Original Message-
> From: r-help-boun...@r-project.org 
> [mailto:r-help-boun...@r-project.org] On Behalf Of jjh21
> Sent: Friday, 9 January 2009 10:07 a.m.
> To: r-help@r-project.org
> Subject: [R] 'equivalent' sign in plot title
> 
> 
> Hello,
> 
> I would like to add the 'equivalent' sign (i.e., three 
> horizontal lines, almost like an equal sign) to a plot. Does 
> R have anything like the LaTeX command '\equiv' that I could 
> put into a plot title?
> 
> Thanks
> --
> View this message in context: 
> http://www.nabble.com/%27equivalent%27-sign-in-plot-title-tp21
> 360963p21360963.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 

The contents of this e-mail are confidential and may be subject to legal 
privilege.
 If you are not the intended recipient you must not use, disseminate, 
distribute or
 reproduce all or any part of this e-mail or attachments.  If you have received 
this
 e-mail in error, please notify the sender and delete all material pertaining 
to this
 e-mail.  Any opinion or views expressed in this e-mail are those of the 
individual
 sender and may not represent those of The New Zealand Institute for Plant and
 Food Research Limited.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] 'equivalent' sign in plot title

2009-01-08 Thread jjh21

Hello,

I would like to add the 'equivalent' sign (i.e., three horizontal lines,
almost like an equal sign) to a plot. Does R have anything like the LaTeX
command '\equiv' that I could put into a plot title?

Thanks
-- 
View this message in context: 
http://www.nabble.com/%27equivalent%27-sign-in-plot-title-tp21360963p21360963.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Fw: Re: R Stacked Histogram

2009-01-08 Thread Jason Rupert
Thank you again for your response. 
 
This worked great. 
 
Quick question about the legend for qplot.  Instead of being outside the plot, 
is it possible to move the location of the legend to the upper left or right 
corner of the plot?  Could you possibly provide an example.
 
Thank you again for your feedback and insights. 


--- On Wed, 1/7/09, hadley wickham  wrote:

From: hadley wickham 
Subject: Re: Fw: Re: [R] R Stacked Histogram
To: jasonkrup...@yahoo.com, "R-help" 
Date: Wednesday, January 7, 2009, 12:17 PM

Hi Jason,

> Well, one last questions about stack plot (please forgive the lame example
> below).  I thought the below allow me to resize the the "title"
of the
> stacked histogram, but no luck.  Any suggestions as to the modificaiton
> necessary to get it to work?  Right now the title is obscured by the plot
> and my boss will be none too happy.  Thanks again.

Yes, that's a really stupid bug that I accidentally introduced in the
latest version.  You can fix it with:

qplot(mpg, wt, data = mtcars, main = "My title") + opts(plot.title =
theme_text(vjust = 0, size = 16))

or by adding a new line to the end of the title:

qplot(mpg, wt, data = mtcars, main = "My title\n")

Regards,

Hadley
-- 
http://had.co.nz/



  
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] help

2009-01-08 Thread Felipe Carrillo
Hi: 
I am going through some of the xtable examples and I can't make the one below 
work. I need to create a longtable on the fly keeping the column headers for 
all the pages and I thought this example could give some ideas on how to do it. 
I am using Sweave and xtable to create my tables and graphics. I wonder if 
someone could tell me what's wrong. Thanks 

## Not run: 
\begin{small}
\setlongtables
\begin{longtable}{
<>=
cat(paste(c('c', rep('cc', 34/2-1), 'c'), collapse='@{\hspace{2pt}}'))
@ 
}
\hline
\endhead
\hline
\endfoot
<>=
library(xtable)
set.seed(2345)
res <- matrix(sample(0:9, size=34*90, replace=TRUE), ncol=34, nrow=90)
xres <- xtable(res)
digits(xres) <- rep(0, 35)
addtorow <- list()
addtorow$pos <- list()
addtorow$pos[[1]] <- c(seq(4, 40, 5), seq(49, 85, 5))
addtorow$pos[[2]] <- 45
addtorow$command <- c('\vspace{2mm} \n', '\newpage \n')
print(xres, add.to.row=addtorow, include.rownames=FALSE, 
include.colnames=FALSE, only.contents=TRUE, hline.after=NULL)
@
\end{longtable}
\end{small}
## End(Not run)


Felipe D. Carrillo  
Supervisory Fishery Biologist  
Department of the Interior  
US Fish & Wildlife Service  
California, USA

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Another newbie question

2009-01-08 Thread AllenL

Thank you all! In future I will include examples of my code to make things
simpler for you. This is what I settled on:

Sp.presence<-Data[,14:31]   ##The subset of my data set I'm interested in
(the presence/absence data)
Sp.presence$Species<-apply(Sp.presence,1,function(x)
{c(paste(names(Sp.presence)[x==1],collapse=","))})

Yay!
-Allen



AllenL wrote:
> 
> Problem: 
> I have a data frame with 1s and 0s denoting presence/absence of species
> (columns) for particular plot measurements (rows). What I want to do is
> make a new column whose entries for each row is a list of the column names
> in which a species is present (ie. for row one its entry might read:
> "sp1","sp2", etc.). I've tried various functions etc. but can't seem to
> get the syntax right/ the correct combination of functions.
> Thanks in advance!
> -Allen
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Another-newbie-question-tp21337371p21360273.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R in the NY Times

2009-01-08 Thread Carlos J. Gil Bellosta
On Thu, 2009-01-08 at 13:52 -0600, Marc Schwartz wrote:
> Reading the posts on SAS-L since yesterday via Google RSS, where the
> NYT
> article was also posted, some have noted that SAS itself offers online
> support forums (http://support.sas.com/forums/index.jspa). From a
> quick
> review, it looks like the SAS.com forums date back to perhaps early
> 2006, thus possibly accounting for some of the leveling of the posts
> on
> SAS-L recently.

Hello,

Not only that: the corporate intranet of SAS (sections of which are
sometime open for external consultants for certain products) also
contain forums with an uneven traffic flow. These will certainly absorb
part of the traffic that would otherwise hit lists like SAS-L.

In fact, in my five years experience working (also as) a SAS consultant,
I have never posted to SAS-L. However, I have posted (or had my requests
posted by other SAS employees) on these lists.

Having said that, I should also add that R represents a threat to SAS
(which does not stand for Statistical Analysis System for a long time
already) in a business segment that very doubtfully accounts for more
than 5-10% of their revenue. They have to sell about 1000 licenses of
SAS/BASE and SAS/STAT in order to match the annual revenues from a
single license for a single "solution" in a single top tier bank.

It is quite amusing, though, to browse SAS marketing internal
documentation --to which I had access some time ago-- on "how to
compete" against R. The SAS salesperson statement in the article seems
to have been extracted verbatim from them. 

Best regards,

Carlos J. Gil Bellosta
http://www.datanalytics.com

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R in the NY Times

2009-01-08 Thread Marc Schwartz
on 01/08/2009 01:12 PM Andrew Choens wrote:
> On Thu, 2009-01-08 at 10:42 -0600, Stas Kolenikov wrote:
>> A really good measure for R will be the total # of the downloads of
>> r-base for all platforms from all CRAN mirrors (and I would expect
>> that # can be found from the servers' logs). Given that it is so easy
>> to download everything nice and clean and up to date, I would doubt
>> anybody will be distributing CD-ROMs with R install files among
>> friends and colleagues. SAS (and Stata, and SPSS, and Minitab, and...)
>> should have their (internal) number of licenses sold (and yes those
>> come on the disks initially), but those are badly blurred by the
>> network licenses, and are commercial secrets, anyway.
> 
> The number of r-core downloads is definitely NOT representative of the
> number of people using R. If you use R on Windows or OS X, you will
> obviously download R from the mirrors. However, this methodology would
> effectively ignore many users of R on Linux. I use R on a regular basis
> and I have it installed on three separate systems, all running Ubuntu.
> In all of these cases, I am downloading and installing r-core from the
> Ubuntu Mirror in the USA, not from CRAN. 

I would also note that R has been available via the Fedora yum repos for
some time, which as with the Debian/Ubuntu repos, would be missed in
just counting CRAN downloads.

There are quite a few other Linux distributions that have a similar
infrastructure in place where R is available as an 'add-on' or where the
main distribution itself includes R.

Additionally, there are many folks who will build R from source code,
using the updated source tarballs via FTP or, as I do, by getting the
source code right from the R subversion repo. These too would not be
considered in a CRAN based count.

> Of course, the number of Linux users is miniscule compared to the number
> of Windows users, but I think it is safe to say the Linux users are, in
> general, a more tech-savvy group than Windows users and are more likely
> to be comfortable using R's interactive programming interface. I think
> it is also fair to say that MANY (though not all) Linux users would be
> uncomfortable installing SPSS or SAS or Stata onto their open-source
> system and would prefer to use R. Thus, Linux users probably account for
> a higher proportion of R's user-base than they do in the general
> computing population. . . . although I do not claim to actually know
> this proportion.
> 
> Ehh. Comparing the popularity of computer software is incredibly tricky
> to do, especially when some of the software being compared in
> open-source.

Correct. Trying extrapolate the number of users from any of these
measures is quite complex, if doable at all.

Even using the posting frequencies as I did yesterday, needs to be taken
with a grain of salt in trying to attempt to get a sense of growth.

As Dirk noted, the many R-SIG-* e-mail lists have offloaded some level
of traffic from R-Help, which may account for the rate of growth in the
R-Help posts declining somewhat since 2004 as Gabor pointed out, even
though the absolute number of annual posts continues to increase.

Reading the posts on SAS-L since yesterday via Google RSS, where the NYT
article was also posted, some have noted that SAS itself offers online
support forums (http://support.sas.com/forums/index.jspa). From a quick
review, it looks like the SAS.com forums date back to perhaps early
2006, thus possibly accounting for some of the leveling of the posts on
SAS-L recently.

HTH,

Marc Schwartz

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Convert to as.Date

2009-01-08 Thread Rowe, Brian Lee Yung (Portfolio Analytics)
You can use zoo to do this:

library(zoo)
DA <- c("1991q1", "1993q2")
as.Date(as.yearqtr(DA))

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On Behalf Of Shruthi Jayaram
Sent: Thursday, January 08, 2009 1:46 PM
To: r-help@r-project.org
Subject: [R] Convert to as.Date



Hi,

I have an vector object that looks like 

DA <- c("1991q1", "1993q2") 

(first quarter of 1991 etc) and I want to convert it into a date object
using as.Date(). I did this for montly data but am stumped when it comes
to
dealing with quarterly data and as.Date. 

Would anyone be able to help? Would be very grateful for any advice,
sorry
for being such an R-newbie!

Shruthi
-- 
View this message in context:
http://www.nabble.com/Convert-to-as.Date-tp21358286p21358286.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

--
This message w/attachments (message) may be privileged, confidential or 
proprietary, and if you are not an intended recipient, please notify the 
sender, do not use or share it and delete it. Unless specifically indicated, 
this message is not an offer to sell or a solicitation of any investment 
products or other financial product or service, an official confirmation of any 
transaction, or an official statement of Merrill Lynch. Subject to applicable 
law, Merrill Lynch may monitor, review and retain e-communications (EC) 
traveling through its networks/systems. The laws of the country of each 
sender/recipient may impact the handling of EC, and EC may be archived, 
supervised and produced in countries other than the country in which you are 
located. This message cannot be guaranteed to be secure or error-free. 
References to "Merrill Lynch" are references to any company in the Merrill 
Lynch & Co., Inc. group of companies, which are wholly-owned by Bank of America 
Corporation. Secu!
 rities and Insurance Products: * Are Not FDIC Insured * Are Not Bank 
Guaranteed * May Lose Value * Are Not a Bank Deposit * Are Not a Condition to 
Any Banking Service or Activity * Are Not Insured by Any Federal Government 
Agency. Attachments that are part of this E-communication may have additional 
important disclosures and disclaimers, which you should read. This message is 
subject to terms available at the following link: 
http://www.ml.com/e-communications_terms/. By messaging with Merrill Lynch you 
consent to the foregoing.
--

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R in the NY Times

2009-01-08 Thread Rahul-A.Agarwal
I believe R as a package has everything people with little knowledge of
programming can handle  quite easily. Moreover even if someone has no
programming knowledge can learn R without much effort.
I also believe if people in corporate world start using R instead of
other complex software which are very expensive then in this job make we
can save many jobs and can also save people.



-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On Behalf Of ohri2...@gmail.com
Sent: Friday, January 09, 2009 12:58 AM
To: Louis Bajuk-Yorgan
Cc: r-help@r-project.org
Subject: Re: [R] R in the NY Times

Yes I think R as a package can really learn from SAS and SPSS in making
GUI more user friendly , even at the risk of dumbing down some
complexity..

also as a consultant I know that selling software requires a lot of
marketing follow ups..which is why R has lagged behind in actual
implementation and marketing  ( who will go on site at  a client and
implement)...despite being more robust and of course helping companies
save costs in these critical times.

If you market R more and even get a 10 % share of the commercial market,
imagine how many jobs you save by cutting down software costs of the
employers..

Ajay
www.decisionstats.com

On 1/8/09, Louis Bajuk-Yorgan  wrote:
>
> As the product manager for S+, I'd like to comment as well. I think 
> the burgeoning interest in R demonstrates that there's demand for 
> analytics to solve real, business-critical problems in a broad 
> spectrum of companies and roles, and that some of the incumbent 
> analytics offerings, in particular SAS and SPSS, don't sufficiently 
> meet the growing need for analytics in many major companies.
>
> S+ (now TIBCO Spotfire S+) is of course a commercial software package
> based on the S language, which was a forerunner of R as mentioned in 
> the article, and has been widely adopted. It is currently used in a 
> wide variety of areas, including Life Sciences, Financial Services, 
> and Utilities, for applications such as speeding the analysis of 
> clinical trial data, optimizing portfolios, and assessing potential 
> sites for building wind farms.
>
> I welcome, respect, and appreciate the vitality, creativity, and sheer

> productivity of the R community, and the high quality of statistical 
> methods the community creates. And, because of the close historical 
> ties between the two products, it is generally easy to port most R 
> statistics into the commercial S+ environment, and we have worked to 
> make that easier in recent releases.
>
> Once in S+, these analytic methods can be incorporated into intuitive 
> tools for business decision makers and deployed to automated 
> environments, using visual workflows, web-based applications (using 
> standard web services), Spotfire Guided Applications for dynamic 
> visual analysis, and scalable, event-driven architectures using 
> TIBCO's IT infrastructure. S+ also provides some unique offerings, 
> such as the ability to flexibly and efficiently analyze very large
data sets.
>
> In this way, I feel companies can maximize the value of their analytic

> investments to make rapid business decisions, whether those analytics 
> are developed in R or S+.
>
> Regards,
> Lou Bajuk-Yorgan
> Sr. Director, Product Management
> TIBCO Spotfire Division
> lba...@tibco.com
>
> -Original Message-
> From: r-help-boun...@r-project.org 
> [mailto:r-help-boun...@r-project.org]
> On Behalf Of Douglas Bates
> Sent: Wednesday, January 07, 2009 12:58 PM
> To: marc_schwa...@comcast.net
> Cc: r-help@r-project.org
> Subject: Re: [R] R in the NY Times
>
> On Wed, Jan 7, 2009 at 8:50 AM, Marc Schwartz 
>  wrote:
>> on 01/07/2009 08:44 AM Kevin E. Thorpe wrote:
>>> Zaslavsky, Alan M. wrote:
 This article is accompanied by nice pictures of Robert and Ross.

 Data Analysts Captivated by Power of R 
 http://www.nytimes.com/2009/01/07/technology/business-computing/07p
 r
 ogram.html



 January 7, 2009 Data Analysts Captivated by R's Power By ASHLEE 
 VANCE


 SAS says it has noticed R's rising popularity at universities, 
 despite educational discounts on its own software, but it dismisses

 the technology as being of interest to a limited set of people 
 working on very hard tasks.

 "I think it addresses a niche market for high-end data analysts 
 that
>
 want free, readily available code," said Anne H. Milley, director 
 of
>
 technology product marketing at SAS. She adds, "We have customers 
 who build engines for aircraft. I am happy they are not using 
 freeware when I get on a jet."

>>>
>>> Thanks for posting.  Does anyone else find the statement by SAS to 
>>> be
>
>>> humourous yet arrogant and short-sighted?
>>>
>>> Kevin
>
>> It is an ignorant comment by a marketing person who has been spoon 
>> fed
>
>> her lines...it is also a comment being made from a very d

Re: [R] R in the NY Times

2009-01-08 Thread ohri2007
Yes I think R as a package can really learn from SAS and SPSS in
making GUI more user friendly , even at the risk of dumbing down some
complexity..

also as a consultant I know that selling software requires a lot of
marketing follow ups..which is why R has lagged behind in actual
implementation and marketing  ( who will go on site at  a client and
implement)...despite being more robust and of course helping companies
save costs in these critical times.

If you market R more and even get a 10 % share of the commercial
market, imagine how many jobs you save by cutting down software costs
of the employers..

Ajay
www.decisionstats.com

On 1/8/09, Louis Bajuk-Yorgan  wrote:
>
> As the product manager for S+, I'd like to comment as well. I think the
> burgeoning interest in R demonstrates that there's demand for analytics
> to solve real, business-critical problems in a broad spectrum of
> companies and roles, and that some of the incumbent analytics offerings,
> in particular SAS and SPSS, don't sufficiently meet the growing need for
> analytics in many major companies.
>
> S+ (now TIBCO Spotfire S+) is of course a commercial software package
> based on the S language, which was a forerunner of R as mentioned in the
> article, and has been widely adopted. It is currently used in a wide
> variety of areas, including Life Sciences, Financial Services, and
> Utilities, for applications such as speeding the analysis of clinical
> trial data, optimizing portfolios, and assessing potential sites for
> building wind farms.
>
> I welcome, respect, and appreciate the vitality, creativity, and sheer
> productivity of the R community, and the high quality of statistical
> methods the community creates. And, because of the close historical ties
> between the two products, it is generally easy to port most R statistics
> into the commercial S+ environment, and we have worked to make that
> easier in recent releases.
>
> Once in S+, these analytic methods can be incorporated into intuitive
> tools for business decision makers and deployed to automated
> environments, using visual workflows, web-based applications (using
> standard web services), Spotfire Guided Applications for dynamic visual
> analysis, and scalable, event-driven architectures using TIBCO's IT
> infrastructure. S+ also provides some unique offerings, such as the
> ability to flexibly and efficiently analyze very large data sets.
>
> In this way, I feel companies can maximize the value of their analytic
> investments to make rapid business decisions, whether those analytics
> are developed in R or S+.
>
> Regards,
> Lou Bajuk-Yorgan
> Sr. Director, Product Management
> TIBCO Spotfire Division
> lba...@tibco.com
>
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
> On Behalf Of Douglas Bates
> Sent: Wednesday, January 07, 2009 12:58 PM
> To: marc_schwa...@comcast.net
> Cc: r-help@r-project.org
> Subject: Re: [R] R in the NY Times
>
> On Wed, Jan 7, 2009 at 8:50 AM, Marc Schwartz
>  wrote:
>> on 01/07/2009 08:44 AM Kevin E. Thorpe wrote:
>>> Zaslavsky, Alan M. wrote:
 This article is accompanied by nice pictures of Robert and Ross.

 Data Analysts Captivated by Power of R
 http://www.nytimes.com/2009/01/07/technology/business-computing/07pr
 ogram.html



 January 7, 2009 Data Analysts Captivated by R's Power By ASHLEE
 VANCE


 SAS says it has noticed R's rising popularity at universities,
 despite educational discounts on its own software, but it dismisses
 the technology as being of interest to a limited set of people
 working on very hard tasks.

 "I think it addresses a niche market for high-end data analysts that
>
 want free, readily available code," said Anne H. Milley, director of
>
 technology product marketing at SAS. She adds, "We have customers
 who build engines for aircraft. I am happy they are not using
 freeware when I get on a jet."

>>>
>>> Thanks for posting.  Does anyone else find the statement by SAS to be
>
>>> humourous yet arrogant and short-sighted?
>>>
>>> Kevin
>
>> It is an ignorant comment by a marketing person who has been spoon fed
>
>> her lines...it is also a comment being made from a very defensive and
>> insecure posture.
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>


-- 
Regards,

Ajay Ohri
http://tinyurl.com/liajayohri

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R in the NY Times

2009-01-08 Thread Carlos J. Gil Bellosta
On Thu, 2009-01-08 at 10:42 -0600, Stas Kolenikov wrote:
> A really good measure for R will be the total # of the downloads of
> r-base for all platforms from all CRAN mirrors (and I would expect
> that # can be found from the servers' logs). 

Hello,

You obviate here that many of us are downloading R from our Linux
distribution repositories directly. 

Besides, given the free nature of R, some of us install it in several
computers, even, in my case, briefly in somebody else's computer for a
short time if I have an urgent task to solve. Of course, I would never
do (or be able to do) this with SAS...

So, the number of downloads from CRAN servers seems like a lousy proxy
for the total number of users of SAS.

Best regards,

Carlos J. Gil Bellosta
http://www.datanalytics.com

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R in the NY Times

2009-01-08 Thread Louis Bajuk-Yorgan

As the product manager for S+, I'd like to comment as well. I think the
burgeoning interest in R demonstrates that there's demand for analytics
to solve real, business-critical problems in a broad spectrum of
companies and roles, and that some of the incumbent analytics offerings,
in particular SAS and SPSS, don't sufficiently meet the growing need for
analytics in many major companies. 

S+ (now TIBCO Spotfire S+) is of course a commercial software package
based on the S language, which was a forerunner of R as mentioned in the
article, and has been widely adopted. It is currently used in a wide
variety of areas, including Life Sciences, Financial Services, and
Utilities, for applications such as speeding the analysis of clinical
trial data, optimizing portfolios, and assessing potential sites for
building wind farms. 

I welcome, respect, and appreciate the vitality, creativity, and sheer
productivity of the R community, and the high quality of statistical
methods the community creates. And, because of the close historical ties
between the two products, it is generally easy to port most R statistics
into the commercial S+ environment, and we have worked to make that
easier in recent releases.  

Once in S+, these analytic methods can be incorporated into intuitive
tools for business decision makers and deployed to automated
environments, using visual workflows, web-based applications (using
standard web services), Spotfire Guided Applications for dynamic visual
analysis, and scalable, event-driven architectures using TIBCO's IT
infrastructure. S+ also provides some unique offerings, such as the
ability to flexibly and efficiently analyze very large data sets. 

In this way, I feel companies can maximize the value of their analytic
investments to make rapid business decisions, whether those analytics
are developed in R or S+. 

Regards,
Lou Bajuk-Yorgan
Sr. Director, Product Management
TIBCO Spotfire Division
lba...@tibco.com

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On Behalf Of Douglas Bates
Sent: Wednesday, January 07, 2009 12:58 PM
To: marc_schwa...@comcast.net
Cc: r-help@r-project.org
Subject: Re: [R] R in the NY Times

On Wed, Jan 7, 2009 at 8:50 AM, Marc Schwartz
 wrote:
> on 01/07/2009 08:44 AM Kevin E. Thorpe wrote:
>> Zaslavsky, Alan M. wrote:
>>> This article is accompanied by nice pictures of Robert and Ross.
>>>
>>> Data Analysts Captivated by Power of R 
>>> http://www.nytimes.com/2009/01/07/technology/business-computing/07pr
>>> ogram.html
>>>
>>>
>>>
>>> January 7, 2009 Data Analysts Captivated by R's Power By ASHLEE 
>>> VANCE
>>>
>>>
>>> SAS says it has noticed R's rising popularity at universities, 
>>> despite educational discounts on its own software, but it dismisses 
>>> the technology as being of interest to a limited set of people 
>>> working on very hard tasks.
>>>
>>> "I think it addresses a niche market for high-end data analysts that

>>> want free, readily available code," said Anne H. Milley, director of

>>> technology product marketing at SAS. She adds, "We have customers 
>>> who build engines for aircraft. I am happy they are not using 
>>> freeware when I get on a jet."
>>>
>>
>> Thanks for posting.  Does anyone else find the statement by SAS to be

>> humourous yet arrogant and short-sighted?
>>
>> Kevin

> It is an ignorant comment by a marketing person who has been spoon fed

> her lines...it is also a comment being made from a very defensive and 
> insecure posture.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] F-test

2009-01-08 Thread Swanton0822

hi,

i was wondering if i have been giving  ANOVA table in R:

 

Response:MPG

 

   DF Sum SqMean Sq   F vaule   
Pr(>F)

Model   1 216.750216.7506.1272 
0.04811*
Model.Mixture4 167.440 41.8601.1833  
0.40579
Residuals  6 212.250 35.375

 

so i was wondering for this F-test to test on the difference between model,
and for the * number 0.04811, at 5% level, 

is that mean we accept null hypothesis, so there is no evidence of
differences, hence it is no differences?

many thanks. 

-- 
View this message in context: 
http://www.nabble.com/F-test-tp21358033p21358033.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R in the NY Times

2009-01-08 Thread Andrew Choens
On Thu, 2009-01-08 at 10:42 -0600, Stas Kolenikov wrote:
> A really good measure for R will be the total # of the downloads of
> r-base for all platforms from all CRAN mirrors (and I would expect
> that # can be found from the servers' logs). Given that it is so easy
> to download everything nice and clean and up to date, I would doubt
> anybody will be distributing CD-ROMs with R install files among
> friends and colleagues. SAS (and Stata, and SPSS, and Minitab, and...)
> should have their (internal) number of licenses sold (and yes those
> come on the disks initially), but those are badly blurred by the
> network licenses, and are commercial secrets, anyway.

The number of r-core downloads is definitely NOT representative of the
number of people using R. If you use R on Windows or OS X, you will
obviously download R from the mirrors. However, this methodology would
effectively ignore many users of R on Linux. I use R on a regular basis
and I have it installed on three separate systems, all running Ubuntu.
In all of these cases, I am downloading and installing r-core from the
Ubuntu Mirror in the USA, not from CRAN. 

Of course, the number of Linux users is miniscule compared to the number
of Windows users, but I think it is safe to say the Linux users are, in
general, a more tech-savvy group than Windows users and are more likely
to be comfortable using R's interactive programming interface. I think
it is also fair to say that MANY (though not all) Linux users would be
uncomfortable installing SPSS or SAS or Stata onto their open-source
system and would prefer to use R. Thus, Linux users probably account for
a higher proportion of R's user-base than they do in the general
computing population. . . . although I do not claim to actually know
this proportion.

Ehh. Comparing the popularity of computer software is incredibly tricky
to do, especially when some of the software being compared in
open-source.


-- 
Insert something humorous here.  :-)

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Excluding data with apply

2009-01-08 Thread David Winsemius
Well, testing would have been wise.. The last variable in the sample  
dataframe had 5 elements and the use "negation" of a character vector  
is not proper.


> df[ , -c("a","d")]
Error in -c("a", "d") : invalid argument to unary operator

So if you limit yourself to negative indexing of numeric references to  
columns, you should be OK.


df <- data.frame(a=LETTERS[1:4], b= rnorm(4), c=rnorm(4), d=  
letters[5:8])

df[ , -c(1,4)]

   bc
1  0.6056003 -0.002843621
2  0.3949298  0.206188106
3 -0.5362161 -1.381615740
4  0.2826662  0.016430970

> apply(df[,-c(1,4)] , 2, sum)
 b  c
 0.7469803 -1.1618403

The subset function might also be useful if one preferred to use  
column names.


> subset(df, select=c("b","c"))
   bc
1  0.6056003 -0.002843621
2  0.3949298  0.206188106
3 -0.5362161 -1.381615740
4  0.2826662  0.016430970

> apply(subset(df, select=c("b","c")), 2, sum)
 b  c
 0.7469803 -1.1618403

--
David Winsemius

On Jan 8, 2009, at 12:26 PM, David Winsemius wrote:

Using indexing and putting a minus sign in front of a vector of  
column names that you want to exclude would be a typical approach:


df <- data.frame(a=LETTERS[1:4], b= rnorm(4), c=rnorm(4), d=  
letters[5:9])


apply(df[ , -c("a","d")], 2, sum)

(Pretty sure this will run properly but don't have R up an runnign  
to test it.)




--
David Winsemius

On Jan 8, 2009, at 5:52 AM, Christian Kamenik wrote:


Dear all,

'Apply' is a great thing for running functions on rows or columns  
of a matrix:


X <- rnorm(20, mean = 0, sd = 1)
dim(X) <- c(5,4)
apply(X,2,sum)

Is there a way to use apply for excluding rows or columns from a  
matrix to run functions on the remaining rows or columns? I know, I  
could do this with a 'for' loop, but 'apply' would be much easier  
and quicker, and require less programming...


Cheers, Christian

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] cosinor analysis

2009-01-08 Thread Charles C. Berry

On Thu, 8 Jan 2009, Anne Berger wrote:


Hallo,



I didn?t found any facilities for Halbergs cosinor analysis in

  R. This analysis is well known in the Chronobiology as the least
  square approximation of time series using cosine function of known
  period (in my case of 24hours-period). I tried to write a script but
  crashed...


Can you give me some advices, please!?


Anne,

I append a bunch of functions that implement the analysis of Y.L. Tong
(1976) Biometrics 32:85-94.

These are offered as is. To understand them, you will probably need to
refer to the Tong article. The notation I used in coding should come
close to matching that in Tong.

The following code should simulate 20 data for 20 subjects and fit a 
cosinor function to each of them:



source("cosinor.R") ## file of all the functions below
X <- seq(0,24,by=2)
junk <- sim.cosinor(20,1,.1,1,.1,X,0,.1,.1, pi/12)
cosinor.lm.each( y ~ r.ij + s.ij, junk, ~ id )


HTH,

Chuck

###
### ###
### cosinor.R - functions to help in cosinor analysis   ###
### ###
###   Author: Charles C.Berry   ###
###   Date: June 12, 2002   ###
###   Copyright: GPL Version 2 or higher###
### ###
###

### following Y.L. Tong (1976) Biometrics 32:85-94
### and the notation and equation numbering therein


two.to.six <-
  function( M.i, A.i, omega, t.ij, phi.i )
  {
beta.i <- A.i * cos( phi.i )
gamma.i <- A.i * sin( omega * phi.i )
r.ij <- cos( omega * t.ij )
s.ij <- sin( omega * t.ij )
res <- list( M.i = M.i, beta.i=beta.i, gamma.i = gamma.i,
 r.ij = r.ij, s.ij = s.ij )
attr(res,"omega") <- omega
res
  }

six.to.two <-
  function( M.i, beta.i, gamma.i, omega, r.ij, s.ij )
  {
A.i <- sqrt( beta.i^2 + gamma.i^2 )
phi.i <- atan( gamma.i / beta.i )
t.ij <- acos( r.ij ) / omega
res <- list( M.i = M.i, A.i = A.i, phi.i = phi.i, t.ij = t.ij )
attr(res,"omega") <- omega
res
  }
six.to.two.lm <-
  function(fit,frame,omega)
  {
cfs <- coef(fit)
M.i <- unname( cfs[ 1 ] )
beta.i <- unname( cfs["r.ij"] )
gamma.i <- unname( cfs["s.ij"] )
res <- six.to.two( M.i, beta.i, gamma.i, omega, frame$r.ij, frame$s.ij )
attr(res,"omega") <- omega
res

  }

six.to.two.lsfit <-
  function(fit, omega)
  {
cfs <- coef(fit)
M.i <- unname( cfs[ 1, ] )
beta.i <- unname( cfs["r.ij",] )
gamma.i <- unname( cfs["s.ij",] )
 A.i <- sqrt( beta.i^2 + gamma.i^2 )
phi.i <- atan( gamma.i / beta.i )
resss <- colSums( residuals( fit ) ^ 2)
totss <- colSums( fit$qr$qt[ -1, ]^2 )
regss <- totss - resss
n <- nrow( residuals( fit ) )
p <- 3
fstat <- (regss/ (p-1))/(resss/(n - p))
res <- list( M.i = M.i, A.i = A.i, phi.i = phi.i, fstat=fstat )
attr(res,"omega") <- omega
res
  }


eq.two <-
  function(M.i, A.i, phi.i, t.ij , omega)
  {
## just expectation - no epsilon.ij used
M.i + A.i * cos( omega * t.ij - phi.i )
  }

sim.two <-
  function(M.mean, M.sigma, A.mean, A.sigma,
t.ij, phi.mean, phi.sigma, eps.sigma, omega, n=1 )
  {
nct <-
  if (length(dim(t.ij))==0) length(t.ij) else ncol(t.ij)
M.i <- rep( rnorm( n, M.mean, M.sigma ) , each = nct )
A.i <- rep( abs( rnorm( n, A.mean, A.sigma ) ), each = nct )
phi.i <- rep( rnorm( n, phi.mean, phi.sigma ) , each = nct )
epsilon.ij <- rnorm( n * nct, 0, eps.sigma )
res <- eq.two( M.i, A.i, phi.i, t.ij, omega ) + epsilon.ij
res
  }
sim.cosinor <-
  function(n, M.mean, M.sigma, A.mean, A.sigma,
t.ij, phi.mean, phi.sigma, eps.sigma, omega )
  {
y <- sim.two( M.mean, M.sigma, A.mean, A.sigma,
  t.ij, phi.mean, phi.sigma, eps.sigma, omega, n)

res <-
  data.frame( y = y, t.ij = rep( t.ij, n ), id = rep( seq(n), 
each=length(t.ij)))
attr(res,"omega") <- omega
res
  }

r.and.s <-
  function(x,omega)
  {
as.data.frame(two.to.six(0,0,omega, x$t.ij, 0)[c("r.ij","s.ij")])
  }

cosinor.lm <-
  function(formoola, frame ){
if ( !all( is.element( c("r.ij","s.ij"), colnames(frame frame[, 
c("r.ij","s.ij")] <-
  r.and.s( frame, attr(frame, "omega"))
fit <- lm(formoola, frame )
c( unlist( six.to.two.lm( fit, frame, attr( frame, "omega") )[ 1:3 ] ),
   fstat=unname( summary(fit)$fstatistic["value"] ) )
  }

cosinor.lm.each <-
  function(formoola, frame, id ){
if ( !all( is.element( c("r.ij","s.ij"), colnames(frame frame[, 
c("r.ij","s.ij")] <-
  r.and.s( frame, attr(frame, "omega"))
id <- update(id, ~.-1 )
id.var <- all.vars( id )
id.expr <- parse(text=id.var)
clusters <- frame[,id.var]
res <- list()
for (i in unique(clus

Re: [R] how to plot histogram plot and fitted distributions on the same graph

2009-01-08 Thread Greg Snow
Here is a direct quote from the help page for hist:
"if 'FALSE', probability densities, component 'density', are plotted (so that 
the histogram has a total area of one)."

That looks like it may apply to your problem, just figure out what the above 
quote is referring to.  The last example on that help page shows a distribution 
curve over a histogram, and it is not that complicated.  There are other gems 
on knowledge hidden on that page, I recommend reading the whole thing.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of Xin Shi
> Sent: Thursday, January 08, 2009 3:33 AM
> To: r-help@r-project.org
> Subject: [R] how to plot histogram plot and fitted distributions on the
> same graph
> 
> Dear:
> 
> 
> 
> I am trying to plot the histogram graph for my observed data. Then plot
> fitted distribution on the same graph of histogram plot in R.
> 
> 
> 
> 1.histogram plot y.
> 2.based on "1", plotting y1 v. x;
> 3.based on "1", plotting y2 v. x;
> 4.based on "1", plotting y3 v. x;
> 
> 
> 
> All of these four plots must be on the same graph.
> 
> 
> 
> However, I found the difficulty is that the y-axis and x-axis for
> histogram
> plot and fitted distribution plot are different.
> 
> 
> 
> For histogram plot, y presents the frequency and x presents events.
> 
> 
> 
> For fitted distribution plots, y presents the probability and x
> presents
> another variable.
> 
> 
> 
> However, I found out I need histogram plot rather than barplot. This is
> major problem of this work.
> 
> 
> 
> The code I used:
> 
> 
> 
> par(font=1,font.lab=10,font.axis=6)
> 
> pts18=barplot(y,
> ylim=c(0,0.2),xlim=c(2,52),axes=FALSE,border=TRUE,names.arg=x,col="whit
> e")
> 
> axis(2,las=1)
> 
> lines(spline(pts18,y1,n=300,method="natural"),type="l",lty=1)
> 
> lines(spline(pts18,y2,n=300,method="natural"),type="l",lty=2)
> 
> lines(spline(pts18,y3,n=300,method="natural"),type="l",lty=5)
> 
> 
> 
> The data are:
> 
> 
> 
> The observed data:
> 
> 
> 
> y<-c(0.098441926, 0.166430595, 0.121813031, 0.104815864, 0.074362606,
> 
> 0.075779037, 0.055949008, 0.040368272, 0.03470255, 0.029745042,
> 
> 0.032577904, 0.02266289, 0.014872521, 0.014872521, 0.010623229,
> 
> 0.01203966, 0.01203966, 0.008498584, 0.009206799, 0.009915014,
> 
> 0.006373938, 0.003541076, 0.001416431, 0.001416431, 0.005665722,
> 
> 0.002124646, 0.000708215, 0.001416431, 0.004249292, 0.002832861,
> 
> 0.004957507, 0.002124646, 0.000708215, 0, 0.000708215, 0.002124646,
> 
> 0.001416431, 0.001416431, 0.001416431, 0, 0.000708215)
> 
> 
> 
> Fitted distribution 1:
> 
> 
> 
> y1<-c(0.03419162, 0.154201321, 0.129581481, 0.108892454, 0.091506645,
> 
> 0.07689666, 0.064619311, 0.054302168, 0.045632264, 0.0383466,
> 
> 0.032224168, 0.027079245, 0.022755763, 0.01912257, 0.016069453,
> 
> 0.013503798, 0.01134, 0.009535987, 0.008013468, 0.006734034,
> 
> 0.005658876, 0.004755378, 0.003996132, 0.003358108, 0.002821952,
> 
> 0.002371398, 0.00199278, 0.001674612, 0.001407243, 0.001182562,
> 
> 0.000993753, 0.00083509, 0.00070176, 0.000589716, 0.000495562,
> 
> 0.00041644, 0.000349951, 0.000294078, 0.000247125, 0.000207669,
> 
> 0.000174513)
> 
> 
> 
> Fitted distribution 2:
> 
> 
> 
> y2<-c(0.078909441, 0.188048499, 0.117871979, 0.089827482, 0.072368317,
> 
> 0.059928019, 0.050453301, 0.042948906, 0.036851702, 0.031809247,
> 
> 0.027584779, 0.024010745, 0.020963795, 0.01835029, 0.016097393,
> 
> 0.014147335, 0.012453559, 0.010978051, 0.009689433, 0.008561564,
> 
> 0.007572497, 0.006703683, 0.005939358, 0.005266055, 0.00467,
> 
> 0.004147912, 0.003684531, 0.003274633, 0.002911751, 0.00259025,
> 
> 0.002305216, 0.002052353, 0.001827898, 0.001628552, 0.001451415,
> 
> 0.001293939, 0.001153881, 0.001029262, 0.000918338, 0.000819567,
> 
> 0.000731589)
> 
> 
> 
> Fitted distribution 3:
> 
> 
> 
> y3<-c(0.09844545, 0.174856171, 0.1190666, 0.093021492, 0.075639902,
> 
> 0.062740817, 0.052668044, 0.044568247, 0.037931599, 0.032423244,
> 
> 0.027808545, 0.023915327, 0.020612892, 0.01779946, 0.015394205,
> 
> 0.013331948, 0.011559483, 0.010032949, 0.008715898, 0.007577845,
> 
> 0.006593146, 0.005740133, 0.005000424, 0.004358371, 0.003800615,
> 
> 0.003315725, 0.002893892, 0.002526689, 0.002206859, 0.001928146,
> 
> 0.001685148, 0.001473194, 0.001288243, 0.001126794, 0.00098581,
> 
> 0.000862657, 0.000755047, 0.000660991, 0.000578759, 0.000506847,
> 
> 0.000443945)
> 
> 
> 
> x<- c(0, 1, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55,
> 
> 60, 65, 70, 75, 80, 85, 90, 95, 100, 105, 110, 115,
> 
> 120, 125, 130, 135, 140, 145, 150, 155, 160, 165, 170,
> 
> 175, 180, 185, 190, 200)
> 
> 
> 
> Many Thanks!
> 
> 
> 
> Xin
> 
> 
> 
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listi

Re: [R] R and Excel

2009-01-08 Thread Erich Neuwirth
Can't you just set a link to our server?
I do not know how to embed it.
I used Camtasia to produce this video, and it
does all the embedding.


Ajay ohri wrote:
> Hi Erich,
> 
> I would like to share and embed the RExcel Training video (just like
> youtube allows me to) . How can I do that ?
> 
> Regards,
> 
> Ajay
> 
> www.decisionstats.com 
> 
> 
> On Fri, Jan 9, 2009 at 12:20 AM, Ajay ohri  > wrote:
> 
> Hi Erich,
> 
> I saw that it uses a remote server ( which can be the same machine )
> to compute.
> 
> 
> Here is the question-
> 
> What is the remote server is Amazon EC2 which has upscalaing and
> downscaling facillity for RAM and CPU...
> 
> Will it work ?
> 
> is there a SaaS version of this?
> 
> Regards,
> 
> Ajay
> On Thu, Jan 8, 2009 at 11:56 PM, Erich Neuwirth
> mailto:erich.neuwi...@univie.ac.at>>
> wrote:
> 
> There is RExcel (available by downloading the CRAN package
> RExcelInstaller. It allows to transfer data between R and Excel,
> and run R code from within Excel. So you can start with your data in
> Excel, let R do an analysis, and transfer the results back to Excel.
> You can write VBA macros which do this, but "hidden from exposure",
> so the Excel user does not even notice that R is doing the hatd
> work.
> It also has an Excel worksheet function RApply which allows
> to call an R function from an Excel cell formula.
> =RApply("rfun",A1)
> would apply the R function rfun to the value in cell A1.
> If the value in A1 changes, Excel will force R to recalculate
> the formula.
> 
> There is a (half hour long) video demo about RExcel
> at http://rcom.univie.ac.at/RExcelDemo/
> 
> http://rcom.univie.ac.at/ has more information about the project.
> For recent information, visit the Wiki on this site.
> 
> This site also has the alpha version of an OpenOffice add-in
> giving roughly the same functionality.
> It is available at
> http://rcom.univie.ac.at/download/ROOo/
> 
> 
> The main source of information about this project is
> the mailing list. You can subscribe also via the project server,
> http://rcom.univie.ac.at
> 
> 
> 
> ohri2...@gmail.com  wrote:
> > Even using the VBA back of Excel to create interfaces with R would
> > make a lot of sense. Suppose I could have access to VBA macros
> that
> > import and export data into R , it would be great.
> >
> > The R GUI series like Rattle come even closer to Excel...so a VBA
> > _R_ExCel package might  be useful to ordinary folks .
> >
> > Besides Excel costs money, so adding R functions to Open
> Office would
> > help both of them ( if not attempted already)
> >
> > Regards,
> >
> > Ajay
> >
> > www.decisionstats.com 
> >
> > On 1/8/09, Stavros Macrakis  > wrote:
> >>> "Some people familiar with R describe it as a supercharged
> version of
> >>> Microsoft's Excel spreadsheet software..."
> >>>
> >> It is easy to ridicule this line from the NYT article.  But
> this is not only
> >> a very sensible comment by a smart reporter, but also one
> that is good for
> >> R:
> >>
> >> It is good for R because it explains the new (R) in terms of
> the familiar
> >> (Excel).  Of course R can do far more than Excel ever could,
> but most
> >> readers will not be familiar with boxplots, let alone
> studentized bootstrap
> >> confidence intervals, yet R is useful even for elementary
> analyses.
> >>
> >> It is good for R because it will bring us new users.  I have
> often looked
> >> over the shoulders of Excel users struggling to do analyses
> or construct
> >> graphics that are just slightly beyond what Excel makes easy.
> Perhaps the
> >> dataset is too large, or the analysis doesn't fit into the
> spreadsheet
> >> model, or the analysis isn't built-in (and so requires either
> many manual
> >> steps, or Visual Basic programming, or an expensive add-on
> package), or it
> >> requires data sources that Excel doesn't handle well, or it
> has gotten so
> >> complicated that it is unmaintainable in spreadsheet form.  R
> scales better
> >> in every way: in size of problem, in complexity of analysis,
> in data
> >> sources.
> >>
> >> It is good for R because it makes it sound unthreatening and
>  

Re: [R] R and Excel

2009-01-08 Thread Ajay ohri
Hi Erich,
I would like to share and embed the RExcel Training video (just like youtube
allows me to) . How can I do that ?

Regards,

Ajay

www.decisionstats.com


On Fri, Jan 9, 2009 at 12:20 AM, Ajay ohri  wrote:

> Hi Erich,
> I saw that it uses a remote server ( which can be the same machine ) to
> compute.
>
>
> Here is the question-
>
> What is the remote server is Amazon EC2 which has upscalaing and
> downscaling facillity for RAM and CPU...
>
> Will it work ?
>
> is there a SaaS version of this?
>
> Regards,
>
> Ajay
> On Thu, Jan 8, 2009 at 11:56 PM, Erich Neuwirth <
> erich.neuwi...@univie.ac.at> wrote:
>
>> There is RExcel (available by downloading the CRAN package
>> RExcelInstaller. It allows to transfer data between R and Excel,
>> and run R code from within Excel. So you can start with your data in
>> Excel, let R do an analysis, and transfer the results back to Excel.
>> You can write VBA macros which do this, but "hidden from exposure",
>> so the Excel user does not even notice that R is doing the hatd work.
>> It also has an Excel worksheet function RApply which allows
>> to call an R function from an Excel cell formula.
>> =RApply("rfun",A1)
>> would apply the R function rfun to the value in cell A1.
>> If the value in A1 changes, Excel will force R to recalculate the formula.
>>
>> There is a (half hour long) video demo about RExcel
>> at http://rcom.univie.ac.at/RExcelDemo/
>>
>> http://rcom.univie.ac.at/ has more information about the project.
>> For recent information, visit the Wiki on this site.
>>
>> This site also has the alpha version of an OpenOffice add-in
>> giving roughly the same functionality.
>> It is available at
>> http://rcom.univie.ac.at/download/ROOo/
>>
>>
>> The main source of information about this project is
>> the mailing list. You can subscribe also via the project server,
>> http://rcom.univie.ac.at
>>
>>
>>
>> ohri2...@gmail.com wrote:
>> > Even using the VBA back of Excel to create interfaces with R would
>> > make a lot of sense. Suppose I could have access to VBA macros that
>> > import and export data into R , it would be great.
>> >
>> > The R GUI series like Rattle come even closer to Excel...so a VBA
>> > _R_ExCel package might  be useful to ordinary folks .
>> >
>> > Besides Excel costs money, so adding R functions to Open Office would
>> > help both of them ( if not attempted already)
>> >
>> > Regards,
>> >
>> > Ajay
>> >
>> > www.decisionstats.com
>> >
>> > On 1/8/09, Stavros Macrakis  wrote:
>> >>> "Some people familiar with R describe it as a supercharged version of
>> >>> Microsoft's Excel spreadsheet software..."
>> >>>
>> >> It is easy to ridicule this line from the NYT article.  But this is not
>> only
>> >> a very sensible comment by a smart reporter, but also one that is good
>> for
>> >> R:
>> >>
>> >> It is good for R because it explains the new (R) in terms of the
>> familiar
>> >> (Excel).  Of course R can do far more than Excel ever could, but most
>> >> readers will not be familiar with boxplots, let alone studentized
>> bootstrap
>> >> confidence intervals, yet R is useful even for elementary analyses.
>> >>
>> >> It is good for R because it will bring us new users.  I have often
>> looked
>> >> over the shoulders of Excel users struggling to do analyses or
>> construct
>> >> graphics that are just slightly beyond what Excel makes easy. Perhaps
>> the
>> >> dataset is too large, or the analysis doesn't fit into the spreadsheet
>> >> model, or the analysis isn't built-in (and so requires either many
>> manual
>> >> steps, or Visual Basic programming, or an expensive add-on package), or
>> it
>> >> requires data sources that Excel doesn't handle well, or it has gotten
>> so
>> >> complicated that it is unmaintainable in spreadsheet form.  R scales
>> better
>> >> in every way: in size of problem, in complexity of analysis, in data
>> >> sources.
>> >>
>> >> It is good for R because it makes it sound unthreatening and easy, both
>> for
>> >> the person who might consider using R rather than Excel, and for
>> his/her
>> >> management.  Of course, R is not trivial to learn, but you don't have
>> to
>> >> master everything about it to get useful results (just like Excel, I
>> might
>> >> add).
>> >>
>> >> It is good for R because it reminds us that there are other useful
>> computing
>> >> paradigms that we can learn from. The spreadsheet model, including
>> instant
>> >> update, is compelling for a wide range of problems.  I have not used
>> any of
>> >> the R/Excel interface packages, but presumably they combine the
>> advantages
>> >> of the approaches. Perhaps there is room for not just integrating R
>> with
>> >> Excel, but for incorporating the core ideas of Excel into R in some
>> >> intelligent way.
>> >>
>> >> It is good for R because it shows areas where R can be improved.  Excel
>> >> makes it very easy to present tabular data and format it.  It makes it
>> very
>> >> easy to work with summary/contingency tables (pivot tables)
>

Re: [R] R and Excel

2009-01-08 Thread Ajay ohri
Hi Erich,
I saw that it uses a remote server ( which can be the same machine ) to
compute.


Here is the question-

What is the remote server is Amazon EC2 which has upscalaing and downscaling
facillity for RAM and CPU...

Will it work ?

is there a SaaS version of this?

Regards,

Ajay
On Thu, Jan 8, 2009 at 11:56 PM, Erich Neuwirth  wrote:

> There is RExcel (available by downloading the CRAN package
> RExcelInstaller. It allows to transfer data between R and Excel,
> and run R code from within Excel. So you can start with your data in
> Excel, let R do an analysis, and transfer the results back to Excel.
> You can write VBA macros which do this, but "hidden from exposure",
> so the Excel user does not even notice that R is doing the hatd work.
> It also has an Excel worksheet function RApply which allows
> to call an R function from an Excel cell formula.
> =RApply("rfun",A1)
> would apply the R function rfun to the value in cell A1.
> If the value in A1 changes, Excel will force R to recalculate the formula.
>
> There is a (half hour long) video demo about RExcel
> at http://rcom.univie.ac.at/RExcelDemo/
>
> http://rcom.univie.ac.at/ has more information about the project.
> For recent information, visit the Wiki on this site.
>
> This site also has the alpha version of an OpenOffice add-in
> giving roughly the same functionality.
> It is available at
> http://rcom.univie.ac.at/download/ROOo/
>
>
> The main source of information about this project is
> the mailing list. You can subscribe also via the project server,
> http://rcom.univie.ac.at
>
>
>
> ohri2...@gmail.com wrote:
> > Even using the VBA back of Excel to create interfaces with R would
> > make a lot of sense. Suppose I could have access to VBA macros that
> > import and export data into R , it would be great.
> >
> > The R GUI series like Rattle come even closer to Excel...so a VBA
> > _R_ExCel package might  be useful to ordinary folks .
> >
> > Besides Excel costs money, so adding R functions to Open Office would
> > help both of them ( if not attempted already)
> >
> > Regards,
> >
> > Ajay
> >
> > www.decisionstats.com
> >
> > On 1/8/09, Stavros Macrakis  wrote:
> >>> "Some people familiar with R describe it as a supercharged version of
> >>> Microsoft's Excel spreadsheet software..."
> >>>
> >> It is easy to ridicule this line from the NYT article.  But this is not
> only
> >> a very sensible comment by a smart reporter, but also one that is good
> for
> >> R:
> >>
> >> It is good for R because it explains the new (R) in terms of the
> familiar
> >> (Excel).  Of course R can do far more than Excel ever could, but most
> >> readers will not be familiar with boxplots, let alone studentized
> bootstrap
> >> confidence intervals, yet R is useful even for elementary analyses.
> >>
> >> It is good for R because it will bring us new users.  I have often
> looked
> >> over the shoulders of Excel users struggling to do analyses or construct
> >> graphics that are just slightly beyond what Excel makes easy. Perhaps
> the
> >> dataset is too large, or the analysis doesn't fit into the spreadsheet
> >> model, or the analysis isn't built-in (and so requires either many
> manual
> >> steps, or Visual Basic programming, or an expensive add-on package), or
> it
> >> requires data sources that Excel doesn't handle well, or it has gotten
> so
> >> complicated that it is unmaintainable in spreadsheet form.  R scales
> better
> >> in every way: in size of problem, in complexity of analysis, in data
> >> sources.
> >>
> >> It is good for R because it makes it sound unthreatening and easy, both
> for
> >> the person who might consider using R rather than Excel, and for his/her
> >> management.  Of course, R is not trivial to learn, but you don't have to
> >> master everything about it to get useful results (just like Excel, I
> might
> >> add).
> >>
> >> It is good for R because it reminds us that there are other useful
> computing
> >> paradigms that we can learn from. The spreadsheet model, including
> instant
> >> update, is compelling for a wide range of problems.  I have not used any
> of
> >> the R/Excel interface packages, but presumably they combine the
> advantages
> >> of the approaches. Perhaps there is room for not just integrating R with
> >> Excel, but for incorporating the core ideas of Excel into R in some
> >> intelligent way.
> >>
> >> It is good for R because it shows areas where R can be improved.  Excel
> >> makes it very easy to present tabular data and format it.  It makes it
> very
> >> easy to work with summary/contingency tables (pivot tables)
> interactively
> >> and only a little more difficult to do drill-down.  In all cases, its
> >> functionality is limited, but what it can do, it does well.
> >>
> >> It is good for R because it reminds us that there are many people using
> >> other tools who could benefit from outreach from the R community, both
> >> through tools (smoother interoperability) and through education.
> >>
> >> Al

[R] Convert to as.Date

2009-01-08 Thread Shruthi Jayaram

Hi,

I have an vector object that looks like 

DA <- c("1991q1", "1993q2") 

(first quarter of 1991 etc) and I want to convert it into a date object
using as.Date(). I did this for montly data but am stumped when it comes to
dealing with quarterly data and as.Date. 

Would anyone be able to help? Would be very grateful for any advice, sorry
for being such an R-newbie!

Shruthi
-- 
View this message in context: 
http://www.nabble.com/Convert-to-as.Date-tp21358286p21358286.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Excluding data with apply

2009-01-08 Thread Stavros Macrakis
On Thu, Jan 8, 2009 at 5:52 AM, Christian Kamenik <
christian.kame...@giub.unibe.ch> wrote:

>
> 'Apply' is a great thing for running functions on rows or columns of a
> matrix:
>
> X <- rnorm(20, mean = 0, sd = 1)
> dim(X) <- c(5,4)
> apply(X,2,sum)
>
> Is there a way to use apply for excluding rows or columns from a matrix to
> run functions on the remaining rows or columns?


X <- matrix(1:30,5,6)
> X
 [,1] [,2] [,3] [,4] [,5] [,6]
[1,]16   11   16   21   26
[2,]27   12   17   22   27
[3,]38   13   18   23   28
[4,]49   14   19   24   29
[5,]5   10   15   20   25   30
> X[c(-1,-3,-5),c(-2,-4)]
 [,1] [,2] [,3] [,4]
[1,]2   12   22   27
[2,]4   14   24   29
> apply(X[c(-1,-3,-5),c(-2,-4)],c(1),sum)
[1] 63 71
> apply(X[c(-1,-3,-5),c(-2,-4)],c(2),sum)
[1]  6 26 46 56
> apply(X[c(-1,-3,-5),2:4],1,sum)
[1] 36 42
> apply(X[c(-1,-3,-5),c(1,3,5,6)],2,sum)
[1]  6 26 46 56
> apply(X[c(-1,-3,-5),c(T,F,T,F,T,T)],2,sum)
[1]  6 26 46 56

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R Stacked Histogram

2009-01-08 Thread hadley wickham
> # Unfortunately due to a small bug in the current version of ggplot,
> you need to use
> # jpeg with an e to get jpegs
> ggsave(file = "ggsave_qplot_output.jpeg")
>
> # But I'd recommend using png instead - much better quality
> ggsave(file = "ggsave_qplot_output.png")

Here's a cute illustration of why I prefer png to jpeg:
http://lbrandy.com/blog/2008/10/my-first-and-last-webcomic/

Hadley

-- 
http://had.co.nz/

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] interpolation to abscissa

2009-01-08 Thread Greg Snow
If you want to just linearly interpolate, then use the functions approx or 
approxfun from the stats package (one of those that is loaded by default).  See 
the function TkApprox in the TeachingDemos package for an interactive way to 
plot the approximations with the interpolations plotted.  

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of e-letter
> Sent: Thursday, January 08, 2009 9:22 AM
> To: r-help@r-project.org
> Subject: [R] interpolation to abscissa
> 
> Readers,
> 
> I have looked at various documents hosted on the web site; I couldn't
> find anything on interpolation. So I started r and accessed the help
> (help.start()). (by the way is it possible to configure r to open help
> in opera instead of firefox?) Initially I read the help for the akima
> package but couldn't understand it. Next I tried the asplines package
> help.
> 
> I tried to copy the example: x<-c(-3,-2,...
> 
> I realised that the 'n=...' parameter determines the resolution of the
> line, so I practised the following subsequent commands:
> 
> > x<-c(-3,-2,-1,0,1,2,2.5,3)
> > y<-c(0,0,0,0,-1,-1,0,2)
> > plot(x,y,ylim=c(-3,3))
> 
> I get the graph as expected
> 
> Then I enter further commands:
> 
> lines(spline(x,y,n=200),col="blue")
> lines(spline(x,y,n=20),col="blue")
> lines(spline(x,y,n=2),col="blue")
> lines(spline(x, y, n=5), col="blue")
> 
> >From this I learn that n corresponds to line resolution. :)
> 
> However I could not find a way to remove the last 3 commands and then
> show only the first line. How do I achieve this please?
> 
> I am learning this package in order to perform my next task;
> interpolation.
> 
> If I have a linear relationship between two variables and plot the
> results, how do I manipulate the graph to be able to show a value of
> the abscissa, especially for negative values, i.e. where the linear
> line intersects the x axis left of the y axis?
> 
> There are 4 packages that claim interpolation (akima, aspline, interp,
> interpp) but they seem far to complicated, especially the latter two.
> Is there a simpler package I could use?
> 
> Yours,
> 
> rh...@conference.jabber.org
> 
> r 251 (27-06-07)
> mandriva 2008
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R and Excel

2009-01-08 Thread Erich Neuwirth
There is RExcel (available by downloading the CRAN package
RExcelInstaller. It allows to transfer data between R and Excel,
and run R code from within Excel. So you can start with your data in
Excel, let R do an analysis, and transfer the results back to Excel.
You can write VBA macros which do this, but "hidden from exposure",
so the Excel user does not even notice that R is doing the hatd work.
It also has an Excel worksheet function RApply which allows
to call an R function from an Excel cell formula.
=RApply("rfun",A1)
would apply the R function rfun to the value in cell A1.
If the value in A1 changes, Excel will force R to recalculate the formula.

There is a (half hour long) video demo about RExcel
at http://rcom.univie.ac.at/RExcelDemo/

http://rcom.univie.ac.at/ has more information about the project.
For recent information, visit the Wiki on this site.

This site also has the alpha version of an OpenOffice add-in
giving roughly the same functionality.
It is available at
http://rcom.univie.ac.at/download/ROOo/


The main source of information about this project is
the mailing list. You can subscribe also via the project server,
http://rcom.univie.ac.at



ohri2...@gmail.com wrote:
> Even using the VBA back of Excel to create interfaces with R would
> make a lot of sense. Suppose I could have access to VBA macros that
> import and export data into R , it would be great.
> 
> The R GUI series like Rattle come even closer to Excel...so a VBA
> _R_ExCel package might  be useful to ordinary folks .
> 
> Besides Excel costs money, so adding R functions to Open Office would
> help both of them ( if not attempted already)
> 
> Regards,
> 
> Ajay
> 
> www.decisionstats.com
> 
> On 1/8/09, Stavros Macrakis  wrote:
>>> "Some people familiar with R describe it as a supercharged version of
>>> Microsoft's Excel spreadsheet software..."
>>>
>> It is easy to ridicule this line from the NYT article.  But this is not only
>> a very sensible comment by a smart reporter, but also one that is good for
>> R:
>>
>> It is good for R because it explains the new (R) in terms of the familiar
>> (Excel).  Of course R can do far more than Excel ever could, but most
>> readers will not be familiar with boxplots, let alone studentized bootstrap
>> confidence intervals, yet R is useful even for elementary analyses.
>>
>> It is good for R because it will bring us new users.  I have often looked
>> over the shoulders of Excel users struggling to do analyses or construct
>> graphics that are just slightly beyond what Excel makes easy. Perhaps the
>> dataset is too large, or the analysis doesn't fit into the spreadsheet
>> model, or the analysis isn't built-in (and so requires either many manual
>> steps, or Visual Basic programming, or an expensive add-on package), or it
>> requires data sources that Excel doesn't handle well, or it has gotten so
>> complicated that it is unmaintainable in spreadsheet form.  R scales better
>> in every way: in size of problem, in complexity of analysis, in data
>> sources.
>>
>> It is good for R because it makes it sound unthreatening and easy, both for
>> the person who might consider using R rather than Excel, and for his/her
>> management.  Of course, R is not trivial to learn, but you don't have to
>> master everything about it to get useful results (just like Excel, I might
>> add).
>>
>> It is good for R because it reminds us that there are other useful computing
>> paradigms that we can learn from. The spreadsheet model, including instant
>> update, is compelling for a wide range of problems.  I have not used any of
>> the R/Excel interface packages, but presumably they combine the advantages
>> of the approaches. Perhaps there is room for not just integrating R with
>> Excel, but for incorporating the core ideas of Excel into R in some
>> intelligent way.
>>
>> It is good for R because it shows areas where R can be improved.  Excel
>> makes it very easy to present tabular data and format it.  It makes it very
>> easy to work with summary/contingency tables (pivot tables) interactively
>> and only a little more difficult to do drill-down.  In all cases, its
>> functionality is limited, but what it can do, it does well.
>>
>> It is good for R because it reminds us that there are many people using
>> other tools who could benefit from outreach from the R community, both
>> through tools (smoother interoperability) and through education.
>>
>> All in all, characterizing R as a supercharged version of Excel makes a lot
>> of sense.
>>
>>  -s
>>
>>  [[alternative HTML version deleted]]
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
> 
> 
> 
> 
> 
> 
> No virus found in this 

Re: [R] ftp connections for uploading files

2009-01-08 Thread Duncan Temple Lang



Prof Brian Ripley wrote:
Try system() with curl or a decent ftp client (I don't see that package 
RCurl covers this, but it might despite its description only mentioning 
HTTP).


It does support FTP, and all of the protocols that are supported in
the installed libcurl, so it depends the configuration options for 
libcurl itself.


The protocols it handles can be found via the curlVersion() function, e.g.

> curlVersion()
$age
[1] 3

$version
[1] "7.16.3"

$vesion_num
[1] 462851

$host
[1] "powerpc-apple-darwin9.0"

$features
ipv6  ssl libz ntlm gssnegotiate 
largefile
   148   16   32 
   512


$ssl_version
[1] " OpenSSL/0.9.7l"

$ssl_version_num
[1] 0

$libz_version
[1] "1.2.3"

$protocols
[1] "tftp"   "ftp""telnet" "dict"   "ldap"   "http"   "file"   "https"
[9] "ftps"

$ares
[1] ""

$ares_num
[1] 0

$libidn
[1] ""



sessionInfo()
R version 2.9.0 Under development (unstable) (2008-09-27 r46576)
i386-apple-darwin9.5.0

locale:
C

attached base packages:
[1] stats graphics  grDevices datasets  utils methods   base

other attached packages:
[1] ROOXML_0.1-0Rcompression_0.4-0  RGoogleDocs_0.2-0
[4] SVGAnnotation_0.1-0 lattice_0.17-15 RCurl_0.92-0
[7] XML_1.99-0  RTools_0.1-0bitops_1.0-4

loaded via a namespace (and not attached):
[1] grid_2.9.0
>




>  From 'man curl'


   curl offers a busload of useful tricks like proxy support, user authen-
   tication,  ftp upload, HTTP post, SSL connections, cookies, file trans-
   fer resume and more. As you will see below, the amount of features will
   make your head spin!

Ftp protocols (and there are more than one) are fiendishly complicated, 
especially if proxies are involved.


BTW, this is yet another case where knowing your OS would have helped 
give a more precise answer. See the posting guide.


On Thu, 8 Jan 2009, Thomas Loridan wrote:


Hi all,

I would like to upload some plots I create wth R via ftp or something
similar but I don t really understand which command/syntax I should
use:
should I go for  make.socket + write.socket or try and create
environment variables like frp_proxy_user and then ftp my files? how?

many thanks for your help

Thomas

--
Thomas Loridan
King's College email: thomas.lori...@kcl.ac.uk
webpage:http://geography.kcl.ac.uk/micromet/tloridan/index.htm

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html

and provide commented, minimal, self-contained, reproducible code.





__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] VaR-Monte carlo Simulation, Historic simulation, Variance-Covariance Simulation

2009-01-08 Thread Liviu Andronic
On 1/8/09, Maithili Shiva  wrote:
>  Is there any fucntion in R that will help me calculate Value at Risk (VaR) 
> using Monte carlo Simulation , Historic simulation and Variance - Covariance 
> Simulation.
>
There are some "un-published" Crystal Ball functions for R [1], which
may help in running the Monte Carlo simulations.
Regards,
Liviu

[1] http://www.bartell.org/mcs/

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] R and Excel

2009-01-08 Thread ohri2007
Even using the VBA back of Excel to create interfaces with R would
make a lot of sense. Suppose I could have access to VBA macros that
import and export data into R , it would be great.

The R GUI series like Rattle come even closer to Excel...so a VBA
_R_ExCel package might  be useful to ordinary folks .

Besides Excel costs money, so adding R functions to Open Office would
help both of them ( if not attempted already)

Regards,

Ajay

www.decisionstats.com

On 1/8/09, Stavros Macrakis  wrote:
>>
>> "Some people familiar with R describe it as a supercharged version of
>> Microsoft's Excel spreadsheet software..."
>>
>
> It is easy to ridicule this line from the NYT article.  But this is not only
> a very sensible comment by a smart reporter, but also one that is good for
> R:
>
> It is good for R because it explains the new (R) in terms of the familiar
> (Excel).  Of course R can do far more than Excel ever could, but most
> readers will not be familiar with boxplots, let alone studentized bootstrap
> confidence intervals, yet R is useful even for elementary analyses.
>
> It is good for R because it will bring us new users.  I have often looked
> over the shoulders of Excel users struggling to do analyses or construct
> graphics that are just slightly beyond what Excel makes easy. Perhaps the
> dataset is too large, or the analysis doesn't fit into the spreadsheet
> model, or the analysis isn't built-in (and so requires either many manual
> steps, or Visual Basic programming, or an expensive add-on package), or it
> requires data sources that Excel doesn't handle well, or it has gotten so
> complicated that it is unmaintainable in spreadsheet form.  R scales better
> in every way: in size of problem, in complexity of analysis, in data
> sources.
>
> It is good for R because it makes it sound unthreatening and easy, both for
> the person who might consider using R rather than Excel, and for his/her
> management.  Of course, R is not trivial to learn, but you don't have to
> master everything about it to get useful results (just like Excel, I might
> add).
>
> It is good for R because it reminds us that there are other useful computing
> paradigms that we can learn from. The spreadsheet model, including instant
> update, is compelling for a wide range of problems.  I have not used any of
> the R/Excel interface packages, but presumably they combine the advantages
> of the approaches. Perhaps there is room for not just integrating R with
> Excel, but for incorporating the core ideas of Excel into R in some
> intelligent way.
>
> It is good for R because it shows areas where R can be improved.  Excel
> makes it very easy to present tabular data and format it.  It makes it very
> easy to work with summary/contingency tables (pivot tables) interactively
> and only a little more difficult to do drill-down.  In all cases, its
> functionality is limited, but what it can do, it does well.
>
> It is good for R because it reminds us that there are many people using
> other tools who could benefit from outreach from the R community, both
> through tools (smoother interoperability) and through education.
>
> All in all, characterizing R as a supercharged version of Excel makes a lot
> of sense.
>
>  -s
>
>   [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>


-- 
Regards,

Ajay Ohri
http://tinyurl.com/liajayohri

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] lattice question: independent per-row or per-column scaling?

2009-01-08 Thread René J.V. Bertin
Hello - and happy newyear to all of you!

I've got some data that I'm plotting with bwplot, a 3x2x3 design where
the observable decreases with the principle independent factor, but at
different rates.

I'd like to get lattice to impose not a single set of axes ranges
identical for all panels, but ranges that are identical for each panel
row or each column. Effects will stand out much better like that.

I've looked through the documentation of the latest lattice version,
but I don't see a way to achieve this with a simple argument passed to
bwplot. Can it be done otherwise and if so, how?

Thanks,
René Bertin

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Regarding Books on R

2009-01-08 Thread David M Smith
In addition to the other excellent examples already given, I maintain
a list of resources for newcomers to R here:

http://www.revolution-computing.com/community/resources.php#TOC-Resources-for-Newcomers-to-R

I can also suggest this blog category (which will grow further with time):

http://blog.revolution-computing.com/beginner-tips/

# David Smith

On Wed, Jan 7, 2009 at 9:09 PM, Kishore  wrote:
> Hi,
> I have good understanding on Econometrics and statistical techniques.
>  However, I am new to R.  What would be the best way to learn R as I would
> be one of the few in my team started exploring R in your team.  I have got a
> few downloads on R introduction, but I am not a FAN of online reading.  Can
> some one guide me with some books on R and statistical models using R.
>  Sincere thanks And Apologies if this thread was already available...
> Couldn't get in search

-- 
David M Smith 
Director of Community, REvolution Computing www.revolution-computing.com
Tel: +1 (206) 577-4778 x3203 (Seattle, USA)

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] how to plot histogram plot and fitted distributions on the same graph

2009-01-08 Thread Albyn Jones
You are plotting the histogram in the frequency scale.  A quick look  
at the doc page for hist() would reveal the freq option:


  hist(x,freq=FALSE)

then you can add the densities with lines()

albyn

Quoting Xin Shi :


Dear:



I am trying to plot the histogram graph for my observed data. Then plot
fitted distribution on the same graph of histogram plot in R.



1.  histogram plot y.
2.  based on "1", plotting y1 v. x;
3.  based on "1", plotting y2 v. x;
4.  based on "1", plotting y3 v. x;



All of these four plots must be on the same graph.



However, I found the difficulty is that the y-axis and x-axis for histogram
plot and fitted distribution plot are different.



For histogram plot, y presents the frequency and x presents events.



For fitted distribution plots, y presents the probability and x presents
another variable.



However, I found out I need histogram plot rather than barplot. This is
major problem of this work.



The code I used:



par(font=1,font.lab=10,font.axis=6)

pts18=barplot(y,
ylim=c(0,0.2),xlim=c(2,52),axes=FALSE,border=TRUE,names.arg=x,col="white")

axis(2,las=1)

lines(spline(pts18,y1,n=300,method="natural"),type="l",lty=1)

lines(spline(pts18,y2,n=300,method="natural"),type="l",lty=2)

lines(spline(pts18,y3,n=300,method="natural"),type="l",lty=5)



The data are:



The observed data:



y<-c(0.098441926, 0.166430595, 0.121813031, 0.104815864, 0.074362606,

0.075779037, 0.055949008, 0.040368272, 0.03470255, 0.029745042,

0.032577904, 0.02266289, 0.014872521, 0.014872521, 0.010623229,

0.01203966, 0.01203966, 0.008498584, 0.009206799, 0.009915014,

0.006373938, 0.003541076, 0.001416431, 0.001416431, 0.005665722,

0.002124646, 0.000708215, 0.001416431, 0.004249292, 0.002832861,

0.004957507, 0.002124646, 0.000708215, 0, 0.000708215, 0.002124646,

0.001416431, 0.001416431, 0.001416431, 0, 0.000708215)



Fitted distribution 1:



y1<-c(0.03419162, 0.154201321, 0.129581481, 0.108892454, 0.091506645,

0.07689666, 0.064619311, 0.054302168, 0.045632264, 0.0383466,

0.032224168, 0.027079245, 0.022755763, 0.01912257, 0.016069453,

0.013503798, 0.01134, 0.009535987, 0.008013468, 0.006734034,

0.005658876, 0.004755378, 0.003996132, 0.003358108, 0.002821952,

0.002371398, 0.00199278, 0.001674612, 0.001407243, 0.001182562,

0.000993753, 0.00083509, 0.00070176, 0.000589716, 0.000495562,

0.00041644, 0.000349951, 0.000294078, 0.000247125, 0.000207669,

0.000174513)



Fitted distribution 2:



y2<-c(0.078909441, 0.188048499, 0.117871979, 0.089827482, 0.072368317,

0.059928019, 0.050453301, 0.042948906, 0.036851702, 0.031809247,

0.027584779, 0.024010745, 0.020963795, 0.01835029, 0.016097393,

0.014147335, 0.012453559, 0.010978051, 0.009689433, 0.008561564,

0.007572497, 0.006703683, 0.005939358, 0.005266055, 0.00467,

0.004147912, 0.003684531, 0.003274633, 0.002911751, 0.00259025,

0.002305216, 0.002052353, 0.001827898, 0.001628552, 0.001451415,

0.001293939, 0.001153881, 0.001029262, 0.000918338, 0.000819567,

0.000731589)



Fitted distribution 3:



y3<-c(0.09844545, 0.174856171, 0.1190666, 0.093021492, 0.075639902,

0.062740817, 0.052668044, 0.044568247, 0.037931599, 0.032423244,

0.027808545, 0.023915327, 0.020612892, 0.01779946, 0.015394205,

0.013331948, 0.011559483, 0.010032949, 0.008715898, 0.007577845,

0.006593146, 0.005740133, 0.005000424, 0.004358371, 0.003800615,

0.003315725, 0.002893892, 0.002526689, 0.002206859, 0.001928146,

0.001685148, 0.001473194, 0.001288243, 0.001126794, 0.00098581,

0.000862657, 0.000755047, 0.000660991, 0.000578759, 0.000506847,

0.000443945)



x<- c(0, 1, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55,

60, 65, 70, 75, 80, 85, 90, 95, 100, 105, 110, 115,

120, 125, 130, 135, 140, 145, 150, 155, 160, 165, 170,

175, 180, 185, 190, 200)



Many Thanks!



Xin




[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.




__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] NAs are not allowed in subscripted assignments

2009-01-08 Thread Prof Brian Ripley

On Thu, 8 Jan 2009, Rune Schjellerup Philosof wrote:


Browse[1]> j <- c(1,2,NA)
Browse[1]> j[j==1][-1]
[1] NA
Browse[1]> j[j==1][-2]
[1] 1
Browse[1]> j[j==1][-2] <- 2
Error during wrapup: NAs are not allowed in subscripted assignments

As far as I can see, I have no NA in the lhs (not after the second
subscript anyway).


But, it is not 'after the second subscript'.  R evaluates from left to 
right and does not re-evaluate subscripts in the light of subexpressions.


Think of this as (E&OE, since interpreters are far better at this than 
humans)


ind <- j==1 # c(TRUE, FALSE, NA)
tmp1 <- j[ind]  # c(1, NA)
tmp1[-2] <- 2   # tmp1 = c(2, 2)
j[ind] <- tmp1  # j[(c(TRUE, FALSE, NA)] <- c(2,2)

and that last is the problematic subassignment.  You asked to assign the 
second '2' to an unknown element of 'j': if allowed that would make all 
elements NA but then the first value would be unused, so the interpreter 
would think you confused.



Besides, I have a single value on the rhs, so it should be allowed to
have NAs in the lhs, according to help(Extract).


But you do not on one of your subassignments.


What am I missing?
I can see no ambiguite as to what the result of those commands should be
(j == c(2,2,NA)).


I suggest you refrain from using such complicated statements.  Just 
occasionally such constructs are needed for efficiency (potentially fewer 
copies) but very rarely (and only by R masters).



--
Med venlig hilsen
Rune Schjellerup Philosof
Videnskabelig Assistent, Statistik, SDU

Telefon:  6550 3607
Email:rphilo...@health.sdu.dk
Adresse: J.B. Winsløwsvej 9, 5000 Odense C


--
Brian D. Ripley,  rip...@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, UKFax:  +44 1865 272595__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] longtable example

2009-01-08 Thread Felipe Carrillo
Hi:
Could someone try to run this example? I can't make it work.
## Not run: 
 \begin{small}
 \setlongtables
 \begin{longtable}{
 <>=
 cat(paste(c('c', rep('cc', 34/2-1), 'c'), collapse='@{\hspace{2pt}}'))
 @ 
 }
 \hline
 \endhead
 \hline
 \endfoot
 <>=
 library(xtable)
 set.seed(2345)
 res <- matrix(sample(0:9, size=34*90, replace=TRUE), ncol=34, nrow=90)
 xres <- xtable(res)
 digits(xres) <- rep(0, 35)
 addtorow <- list()
 addtorow$pos <- list()
 addtorow$pos[[1]] <- c(seq(4, 40, 5), seq(49, 85, 5))
 addtorow$pos[[2]] <- 45
 addtorow$command <- c('\vspace{2mm} \n', '\newpage \n')
 print(xres, add.to.row=addtorow, include.rownames=FALSE, 
include.colnames=FALSE, only.contents=TRUE, hline.after=NULL)
 @
 \end{longtable}
 \end{small}
## End(Not run)


Felipe D. Carrillo  
Supervisory Fishery Biologist  
Department of the Interior  
US Fish & Wildlife Service  
California, USA

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Letter-based representation of pairwise comparisons

2009-01-08 Thread hadley wickham
On Thu, Jan 8, 2009 at 5:40 AM, retama  wrote:
>
> Hi!
>
> I have been working several years with R but it's my first public question.
> I hope I'll be clear :) .
>
> This question is related to obtaining letter-based representation of
> non-parametric pairwise comparisons.
>
> I have a dataframe with this structure (but with quite more rows and cols):
>
> A B C  factor
> 1 2 2 one
> 2 1 2 one
> 2 2 3 two
> 2 3 2 two
> 1 4 2 three
> 9 8 1 three
>
> I have no normality, so I did a kruskal test which showed significant
> differences in some cases. As post hoc pairwise comparisons (the idea is to
> make an equivalent to Tukey test after an ANOVA) I tried with a paired
> wilcoxon test with the Bonferroni's correction (pairwise.wilcox.test(A,
> factor, p.adj="bonf") and other for B, and so on) and, now, I need to modify
> the output to show a letter-based representation of all pairwise
> comparisons. Some algorithms have been published
> (http://www.accessmylibrary.com/coms2/summary_0286-21655824_ITM), but I
> can't find an R implementation.

http://cran.r-project.org/web/packages/multcompView/ ?

Hadley

-- 
http://had.co.nz/

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] ftp connections for uploading files

2009-01-08 Thread Prof Brian Ripley

On Thu, 8 Jan 2009, Gábor Csárdi wrote:


On Thu, Jan 8, 2009 at 5:42 PM, Thomas Loridan  wrote:

Many thanks for that.
I am running R under windows and I am not sure what you mean by this curl?


http://curl.haxx.se/


And it comes as standard on Mac OS X and many Linux distros.
(Generally people who fail to provide the requested information should 
expect to Google for themselves, not expect their helpers to do such 
basic research for them.)



Is'nt there a way to ftp via an intrinsic R function?


That I don't know, perhaps some else does. You might want to double
check the RCurl package.


Yes, I do know about 'intrinsic R', and did you think the author of the R 
Internet connectivity would not have said so if there was? (Also the 
person who provides the RCurl port for Windows.)




Gabor



Thanks again

Thomas

2009/1/8 Prof Brian Ripley :

Try system() with curl or a decent ftp client (I don't see that package
RCurl covers this, but it might despite its description only mentioning
HTTP).  From 'man curl'

  curl offers a busload of useful tricks like proxy support, user authen-
  tication,  ftp upload, HTTP post, SSL connections, cookies, file trans-
  fer resume and more. As you will see below, the amount of features will
  make your head spin!

Ftp protocols (and there are more than one) are fiendishly complicated,
especially if proxies are involved.

BTW, this is yet another case where knowing your OS would have helped give a
more precise answer. See the posting guide.

On Thu, 8 Jan 2009, Thomas Loridan wrote:


Hi all,

I would like to upload some plots I create wth R via ftp or something
similar but I don t really understand which command/syntax I should
use:
should I go for  make.socket + write.socket or try and create
environment variables like frp_proxy_user and then ftp my files? how?

many thanks for your help

Thomas


--
Brian D. Ripley,  rip...@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, UKFax:  +44 1865 272595__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Excluding data with apply

2009-01-08 Thread David Winsemius
Using indexing and putting a minus sign in front of a vector of column  
names that you want to exclude would be a typical approach:


df <- data.frame(a=LETTERS[1:4], b= rnorm(4), c=rnorm(4), d=  
letters[5:9])


apply(df[ , -c("a","d")], 2, sum)

(Pretty sure this will run properly but don't have R up an runnign to  
test it.)




--
David Winsemius

On Jan 8, 2009, at 5:52 AM, Christian Kamenik wrote:


Dear all,

'Apply' is a great thing for running functions on rows or columns of  
a matrix:


X <- rnorm(20, mean = 0, sd = 1)
dim(X) <- c(5,4)
apply(X,2,sum)

Is there a way to use apply for excluding rows or columns from a  
matrix to run functions on the remaining rows or columns? I know, I  
could do this with a 'for' loop, but 'apply' would be much easier  
and quicker, and require less programming...


Cheers, Christian

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] ftp connections for uploading files

2009-01-08 Thread Gábor Csárdi
On Thu, Jan 8, 2009 at 5:42 PM, Thomas Loridan  wrote:
> Many thanks for that.
> I am running R under windows and I am not sure what you mean by this curl?

http://curl.haxx.se/

> Is'nt there a way to ftp via an intrinsic R function?

That I don't know, perhaps some else does. You might want to double
check the RCurl package.

Gabor

>
> Thanks again
>
> Thomas
>
> 2009/1/8 Prof Brian Ripley :
>> Try system() with curl or a decent ftp client (I don't see that package
>> RCurl covers this, but it might despite its description only mentioning
>> HTTP).  From 'man curl'
>>
>>   curl offers a busload of useful tricks like proxy support, user authen-
>>   tication,  ftp upload, HTTP post, SSL connections, cookies, file trans-
>>   fer resume and more. As you will see below, the amount of features will
>>   make your head spin!
>>
>> Ftp protocols (and there are more than one) are fiendishly complicated,
>> especially if proxies are involved.
>>
>> BTW, this is yet another case where knowing your OS would have helped give a
>> more precise answer. See the posting guide.
>>
>> On Thu, 8 Jan 2009, Thomas Loridan wrote:
>>
>>> Hi all,
>>>
>>> I would like to upload some plots I create wth R via ftp or something
>>> similar but I don t really understand which command/syntax I should
>>> use:
>>> should I go for  make.socket + write.socket or try and create
>>> environment variables like frp_proxy_user and then ftp my files? how?
>>>
>>> many thanks for your help
>>>
>>> Thomas
>>>
>>> --
>>> Thomas Loridan
>>> King's College email: thomas.lori...@kcl.ac.uk
>>> webpage:http://geography.kcl.ac.uk/micromet/tloridan/index.htm
>>>
>>> __
>>> R-help@r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide
>>> http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>
>> --
>> Brian D. Ripley,  rip...@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, UKFax:  +44 1865 272595
>>
>
>
>
> --
> Thomas Loridan
> King's College email: thomas.lori...@kcl.ac.uk
> webpage:http://geography.kcl.ac.uk/micromet/tloridan/index.htm
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Gabor Csardi  UNIL DGM

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Why Excel is our friend

2009-01-08 Thread Stavros Macrakis
>
> "Some people familiar with R describe it as a supercharged version of
> Microsoft's Excel spreadsheet software..."
>

It is easy to ridicule this line from the NYT article.  But this is not only
a very sensible comment by a smart reporter, but also one that is good for
R:

It is good for R because it explains the new (R) in terms of the familiar
(Excel).  Of course R can do far more than Excel ever could, but most
readers will not be familiar with boxplots, let alone studentized bootstrap
confidence intervals, yet R is useful even for elementary analyses.

It is good for R because it will bring us new users.  I have often looked
over the shoulders of Excel users struggling to do analyses or construct
graphics that are just slightly beyond what Excel makes easy. Perhaps the
dataset is too large, or the analysis doesn't fit into the spreadsheet
model, or the analysis isn't built-in (and so requires either many manual
steps, or Visual Basic programming, or an expensive add-on package), or it
requires data sources that Excel doesn't handle well, or it has gotten so
complicated that it is unmaintainable in spreadsheet form.  R scales better
in every way: in size of problem, in complexity of analysis, in data
sources.

It is good for R because it makes it sound unthreatening and easy, both for
the person who might consider using R rather than Excel, and for his/her
management.  Of course, R is not trivial to learn, but you don't have to
master everything about it to get useful results (just like Excel, I might
add).

It is good for R because it reminds us that there are other useful computing
paradigms that we can learn from. The spreadsheet model, including instant
update, is compelling for a wide range of problems.  I have not used any of
the R/Excel interface packages, but presumably they combine the advantages
of the approaches. Perhaps there is room for not just integrating R with
Excel, but for incorporating the core ideas of Excel into R in some
intelligent way.

It is good for R because it shows areas where R can be improved.  Excel
makes it very easy to present tabular data and format it.  It makes it very
easy to work with summary/contingency tables (pivot tables) interactively
and only a little more difficult to do drill-down.  In all cases, its
functionality is limited, but what it can do, it does well.

It is good for R because it reminds us that there are many people using
other tools who could benefit from outreach from the R community, both
through tools (smoother interoperability) and through education.

All in all, characterizing R as a supercharged version of Excel makes a lot
of sense.

 -s

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Generating GUI for r-scripts

2009-01-08 Thread Bert Gunter
If you are on Windows (you didn't say!) see also ?winMenuAdd, ?winDialog
?choose.files  etc.

-- Bert Gunter
Genentech

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Mike Prager
Sent: Thursday, January 08, 2009 8:29 AM
To: r-h...@stat.math.ethz.ch
Subject: Re: [R] Generating GUI for r-scripts

Daren Tan  wrote:

>>>
I have developed some scripts that basically ask for input
tab-limited format files, do some processing, and output several
pictures or csv. Now I need to have some gui to wrap on top of
the scripts, [...] Please advice me if there is any tools or
project suitable for my tasks.

you might take a look at package tcltk, which provides GUI tools
by binding to Tcl/Tk.  It could meet your requirements.


-- 
Mike Prager, NOAA, Beaufort, NC
* Opinions expressed are personal and not represented otherwise.
* Any use of tradenames does not constitute a NOAA endorsement.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] ftp connections for uploading files

2009-01-08 Thread Thomas Loridan
Hi all,

I would like to upload some plots I create wth R via ftp or something
similar but I don t really understand which command/syntax I should
use:
should I go for  make.socket + write.socket or try and create
environment variables like frp_proxy_user and then ftp my files? how?

many thanks for your help

Thomas

-- 
Thomas Loridan
King's College email: thomas.lori...@kcl.ac.uk
webpage:http://geography.kcl.ac.uk/micromet/tloridan/index.htm

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Numerical Integration Problems

2009-01-08 Thread Christos Argyropoulos

 
Hi, 
You may want to try the double exponential transformation on the numerator and 
the denominator on this one.
The method is described in detail here:
http://projecteuclid.org/DPubS?service=UI&version=1.0&verb=Display&handle=euclid.prims/1145474600
 
 
 
If you want to give it a shot outside R there are a couple of C/C++ 
implementations out there:
http://www.codeproject.com/KB/recipes/FastNumericalIntegration.aspx
http://www.crbond.com/download/deint.c
 
I have used the second one in a project of mine that is similar to the one you 
describe (calculation of posterior expectations in Bayesian inference), and I 
can say that it works reasonably well.
 
As a side note, the DE method is one (actually the default) of the numerical 
integration methods implemented by Mathematica's NIntegrate function. It would 
be nice if someone found the time to augment R's integration facilities with 
this (and possibly other) numerical integration methods.
 
Christos Argyropoulos
University of Pittsburgh Medical Center 
_

s. It's easy!

aspx&mkt=en-us
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Excluding data with apply

2009-01-08 Thread Christian Kamenik

Dear all,

'Apply' is a great thing for running functions on rows or columns of a 
matrix:


X <- rnorm(20, mean = 0, sd = 1)
dim(X) <- c(5,4)
apply(X,2,sum)

Is there a way to use apply for excluding rows or columns from a matrix 
to run functions on the remaining rows or columns? I know, I could do 
this with a 'for' loop, but 'apply' would be much easier and quicker, 
and require less programming...


Cheers, Christian

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] cosinor analysis

2009-01-08 Thread Anne Berger
Hallo,
I didn´t found any facilities for Halbergs cosinor analysis in R. This analysis 
is well known in the Chronobiology as the least square approximation of time 
series using cosine function of known period (in my case of 24hours-period). I 
tried to write a script but crashed...
Can you give me some advices, please!?
Thanks
Anne Berger
Institute of Zoo- and Wildlife Research, Berlin, Germany
Swedish University of Agricultural Sciences, Dept. of Wildlife, Fish and 
Environmental Studies, Umeå, Sweden

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Converting data frame to symmetric matrix

2009-01-08 Thread poastpd

Thank you.  It worked!

Quoting Henrique Dallazuanna :


Try this:

reshape(d, timevar = "x", idvar = "y", direction = "wide")

On Tue, Jan 6, 2009 at 6:29 AM,  wrote:


Dear Sir or Madam,

I have the following data frame (which is just a toy example of my larger
dataset)

L3 <- LETTERS[1:3]
x=c(1,1,2,2,3,3,4,4,5,5)
y=1:10
d <- data.frame(cbind(x,y), fac=sample(L3, 10, replace=TRUE))


This data frame produces the following output

  x  y fac
1  1  1   C
2  1  2   C
3  2  3   B
4  2  4   B
5  3  5   C
6  3  6   B
7  4  7   B
8  4  8   C
9  5  9   B
10 5 10   A


Is there a command I can use to convert data frame d into a 10 X 10
symmetric matrix where the columns are labeled 1 through 10, the rows are
labeled 1 through 10, and the entries in each cell are the corresponding
values of "fac"?

For example, the first two columns and rows should have the following
entries:

 1  2
1 C  C

2 C  NA

Any suggestions will be greatly appreciated.

Many thanks,

Paul Poast

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.





--
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O



__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Letter-based representation of pairwise comparisons

2009-01-08 Thread retama

Hi!

I have been working several years with R but it's my first public question.
I hope I'll be clear :) .

This question is related to obtaining letter-based representation of
non-parametric pairwise comparisons.

I have a dataframe with this structure (but with quite more rows and cols):

A B C  factor
1 2 2 one
2 1 2 one
2 2 3 two
2 3 2 two
1 4 2 three
9 8 1 three

I have no normality, so I did a kruskal test which showed significant
differences in some cases. As post hoc pairwise comparisons (the idea is to
make an equivalent to Tukey test after an ANOVA) I tried with a paired
wilcoxon test with the Bonferroni's correction (pairwise.wilcox.test(A,
factor, p.adj="bonf") and other for B, and so on) and, now, I need to modify
the output to show a letter-based representation of all pairwise
comparisons. Some algorithms have been published
(http://www.accessmylibrary.com/coms2/summary_0286-21655824_ITM), but I
can't find an R implementation.

Does anyone know how to do that?

Thank you!!

Retama
-- 
View this message in context: 
http://www.nabble.com/Letter-based-representation-of-pairwise-comparisons-tp21350364p21350364.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] how to plot histogram plot and fitted distributions on the same graph

2009-01-08 Thread Xin Shi
Dear:

 

I am trying to plot the histogram graph for my observed data. Then plot
fitted distribution on the same graph of histogram plot in R.

 

1.  histogram plot y.
2.  based on "1", plotting y1 v. x;
3.  based on "1", plotting y2 v. x;
4.  based on "1", plotting y3 v. x;

 

All of these four plots must be on the same graph.

 

However, I found the difficulty is that the y-axis and x-axis for histogram
plot and fitted distribution plot are different.

 

For histogram plot, y presents the frequency and x presents events.

 

For fitted distribution plots, y presents the probability and x presents
another variable.

 

However, I found out I need histogram plot rather than barplot. This is
major problem of this work.

 

The code I used:

 

par(font=1,font.lab=10,font.axis=6)

pts18=barplot(y,
ylim=c(0,0.2),xlim=c(2,52),axes=FALSE,border=TRUE,names.arg=x,col="white")

axis(2,las=1)

lines(spline(pts18,y1,n=300,method="natural"),type="l",lty=1) 

lines(spline(pts18,y2,n=300,method="natural"),type="l",lty=2)

lines(spline(pts18,y3,n=300,method="natural"),type="l",lty=5)

 

The data are:

 

The observed data:

 

y<-c(0.098441926, 0.166430595, 0.121813031, 0.104815864, 0.074362606, 

0.075779037, 0.055949008, 0.040368272, 0.03470255, 0.029745042, 

0.032577904, 0.02266289, 0.014872521, 0.014872521, 0.010623229, 

0.01203966, 0.01203966, 0.008498584, 0.009206799, 0.009915014, 

0.006373938, 0.003541076, 0.001416431, 0.001416431, 0.005665722, 

0.002124646, 0.000708215, 0.001416431, 0.004249292, 0.002832861, 

0.004957507, 0.002124646, 0.000708215, 0, 0.000708215, 0.002124646, 

0.001416431, 0.001416431, 0.001416431, 0, 0.000708215)

 

Fitted distribution 1:

 

y1<-c(0.03419162, 0.154201321, 0.129581481, 0.108892454, 0.091506645, 

0.07689666, 0.064619311, 0.054302168, 0.045632264, 0.0383466, 

0.032224168, 0.027079245, 0.022755763, 0.01912257, 0.016069453, 

0.013503798, 0.01134, 0.009535987, 0.008013468, 0.006734034, 

0.005658876, 0.004755378, 0.003996132, 0.003358108, 0.002821952, 

0.002371398, 0.00199278, 0.001674612, 0.001407243, 0.001182562, 

0.000993753, 0.00083509, 0.00070176, 0.000589716, 0.000495562, 

0.00041644, 0.000349951, 0.000294078, 0.000247125, 0.000207669, 

0.000174513)

 

Fitted distribution 2:

 

y2<-c(0.078909441, 0.188048499, 0.117871979, 0.089827482, 0.072368317, 

0.059928019, 0.050453301, 0.042948906, 0.036851702, 0.031809247, 

0.027584779, 0.024010745, 0.020963795, 0.01835029, 0.016097393, 

0.014147335, 0.012453559, 0.010978051, 0.009689433, 0.008561564, 

0.007572497, 0.006703683, 0.005939358, 0.005266055, 0.00467, 

0.004147912, 0.003684531, 0.003274633, 0.002911751, 0.00259025, 

0.002305216, 0.002052353, 0.001827898, 0.001628552, 0.001451415, 

0.001293939, 0.001153881, 0.001029262, 0.000918338, 0.000819567, 

0.000731589)

 

Fitted distribution 3:

 

y3<-c(0.09844545, 0.174856171, 0.1190666, 0.093021492, 0.075639902, 

0.062740817, 0.052668044, 0.044568247, 0.037931599, 0.032423244, 

0.027808545, 0.023915327, 0.020612892, 0.01779946, 0.015394205, 

0.013331948, 0.011559483, 0.010032949, 0.008715898, 0.007577845, 

0.006593146, 0.005740133, 0.005000424, 0.004358371, 0.003800615, 

0.003315725, 0.002893892, 0.002526689, 0.002206859, 0.001928146, 

0.001685148, 0.001473194, 0.001288243, 0.001126794, 0.00098581, 

0.000862657, 0.000755047, 0.000660991, 0.000578759, 0.000506847, 

0.000443945)

 

x<- c(0, 1, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 

60, 65, 70, 75, 80, 85, 90, 95, 100, 105, 110, 115, 

120, 125, 130, 135, 140, 145, 150, 155, 160, 165, 170, 

175, 180, 185, 190, 200)

 

Many Thanks!

 

Xin

 


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] ftp connections for uploading files

2009-01-08 Thread Thomas Loridan
Many thanks for that.
I am running R under windows and I am not sure what you mean by this curl?
Is'nt there a way to ftp via an intrinsic R function?

Thanks again

Thomas

2009/1/8 Prof Brian Ripley :
> Try system() with curl or a decent ftp client (I don't see that package
> RCurl covers this, but it might despite its description only mentioning
> HTTP).  From 'man curl'
>
>   curl offers a busload of useful tricks like proxy support, user authen-
>   tication,  ftp upload, HTTP post, SSL connections, cookies, file trans-
>   fer resume and more. As you will see below, the amount of features will
>   make your head spin!
>
> Ftp protocols (and there are more than one) are fiendishly complicated,
> especially if proxies are involved.
>
> BTW, this is yet another case where knowing your OS would have helped give a
> more precise answer. See the posting guide.
>
> On Thu, 8 Jan 2009, Thomas Loridan wrote:
>
>> Hi all,
>>
>> I would like to upload some plots I create wth R via ftp or something
>> similar but I don t really understand which command/syntax I should
>> use:
>> should I go for  make.socket + write.socket or try and create
>> environment variables like frp_proxy_user and then ftp my files? how?
>>
>> many thanks for your help
>>
>> Thomas
>>
>> --
>> Thomas Loridan
>> King's College email: thomas.lori...@kcl.ac.uk
>> webpage:http://geography.kcl.ac.uk/micromet/tloridan/index.htm
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
> --
> Brian D. Ripley,  rip...@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, UKFax:  +44 1865 272595
>



-- 
Thomas Loridan
King's College email: thomas.lori...@kcl.ac.uk
webpage:http://geography.kcl.ac.uk/micromet/tloridan/index.htm

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R in the NY Times

2009-01-08 Thread Stas Kolenikov
On 1/7/09, Gabor Grothendieck  wrote:
> Here is the same number of messages/posts data
>  for each of S, SAS, R:
>  - reworked into a 3 column ts class time series
>  - with Jan 2009 removed since its not complete
>  - leading and trailing NA rows removed

My software of choice is Stata, so here are compatible data from
statalist (using
http://www.hsph.harvard.edu/cgi-bin/lwgate/STATALIST/archives/):

## Statalist traffic
stata <- structure(c(
654,574,781, 848, 714, 823,1063,1057,
701,625,909, 799, 941,1052,1013,1269,
868,690,937,1155,1040,1113,1125,1252,
640,649,899, 898,1013,1161, 991,1325,
622,697,726,1102, 818,1077,,1374,
684,548,651, 876, 964, 963,1125,1078,
717,588,943, 923, 885, 892, 986,1200,
728,575,605, 901,1010,1011,1224,1396,
627,605,712, 807,1098, 951, 939,1446,
844,790,970, 940,1001,1283,1231,1509,
776,644,870, 928,1094, 928, 999,1340,
603,512,670, 824, 794, 951, 739,1056
),
.Dim = c(8L, 12L),
.Dimnames = list(c("2001", "2002", "2003", "2004", "2005",
"2006", "2007", "2008"), c("Jan", "Feb", "Mar", "Apr",
"May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")))

The list existed from 1994 or 1996 or so, but the data are only
available from 2001. You'd probably be surprised to find out that
based on the list summaries, the size of Stata world is about half of
SAS on the counts plot; and on the log scale, it shows linear (which
means, exponential) growth throughout the range, while both SAS and R
have been slowing down in the last couple of years (with an
explanation already offered regarding the r-sig-* lists).

Of course overall that's an incorrect comparison, to begin with. The
support systems for all three packages are different: most (US)
universities will have dedicated and well-certified SAS gurus
answering most semicolon questions locally, while r-help would be the
first thing on my mind if I cannot get what I need in the docs. I
would thus expect traffic on r-help will to be heavier relative to the
user base.

Another measure of interest might be the number of contributed
packages. The phrase for R is this: "Currently, the CRAN package
repository features 1633 objects including 1625 packages and 8 bundles
containing 34 packages, for a total of 1659 available packages." The
phrase for Stata is this: "Statistical Software Components,
Boston College Department of Economics: There are currently 1275 items
in this series, of which 1274 are downloadable"
(http://logec.repec.org/scripts/seriesstat.pl?item=repec:boc:bocode).
So programming activity in Stata is about 3/4 of that in R at their
face values (you would probably need to downplay both numbers for
obsolete packages, though). Whether SAS has a unified repository of
user contributed modules with direct counts available, I have no clue.

A really good measure for R will be the total # of the downloads of
r-base for all platforms from all CRAN mirrors (and I would expect
that # can be found from the servers' logs). Given that it is so easy
to download everything nice and clean and up to date, I would doubt
anybody will be distributing CD-ROMs with R install files among
friends and colleagues. SAS (and Stata, and SPSS, and Minitab, and...)
should have their (internal) number of licenses sold (and yes those
come on the disks initially), but those are badly blurred by the
network licenses, and are commercial secrets, anyway.

-- 
Stas Kolenikov, also found at http://stas.kolenikov.name
Small print: I use this email account for mailing lists only.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Generating GUI for r-scripts

2009-01-08 Thread Mike Prager
Daren Tan  wrote:

>>>
I have developed some scripts that basically ask for input
tab-limited format files, do some processing, and output several
pictures or csv. Now I need to have some gui to wrap on top of
the scripts, [...] Please advice me if there is any tools or
project suitable for my tasks.

you might take a look at package tcltk, which provides GUI tools
by binding to Tcl/Tk.  It could meet your requirements.


-- 
Mike Prager, NOAA, Beaufort, NC
* Opinions expressed are personal and not represented otherwise.
* Any use of tradenames does not constitute a NOAA endorsement.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] interpolation to abscissa

2009-01-08 Thread e-letter
Readers,

I have looked at various documents hosted on the web site; I couldn't
find anything on interpolation. So I started r and accessed the help
(help.start()). (by the way is it possible to configure r to open help
in opera instead of firefox?) Initially I read the help for the akima
package but couldn't understand it. Next I tried the asplines package
help.

I tried to copy the example: x<-c(-3,-2,...

I realised that the 'n=...' parameter determines the resolution of the
line, so I practised the following subsequent commands:

> x<-c(-3,-2,-1,0,1,2,2.5,3)
> y<-c(0,0,0,0,-1,-1,0,2)
> plot(x,y,ylim=c(-3,3))

I get the graph as expected

Then I enter further commands:

lines(spline(x,y,n=200),col="blue")
lines(spline(x,y,n=20),col="blue")
lines(spline(x,y,n=2),col="blue")
lines(spline(x, y, n=5), col="blue")

>From this I learn that n corresponds to line resolution. :)

However I could not find a way to remove the last 3 commands and then
show only the first line. How do I achieve this please?

I am learning this package in order to perform my next task; interpolation.

If I have a linear relationship between two variables and plot the
results, how do I manipulate the graph to be able to show a value of
the abscissa, especially for negative values, i.e. where the linear
line intersects the x axis left of the y axis?

There are 4 packages that claim interpolation (akima, aspline, interp,
interpp) but they seem far to complicated, especially the latter two.
Is there a simpler package I could use?

Yours,

rh...@conference.jabber.org

r 251 (27-06-07)
mandriva 2008

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] ftp connections for uploading files

2009-01-08 Thread Prof Brian Ripley
Try system() with curl or a decent ftp client (I don't see that package 
RCurl covers this, but it might despite its description only mentioning 
HTTP).  From 'man curl'


   curl offers a busload of useful tricks like proxy support, user authen-
   tication,  ftp upload, HTTP post, SSL connections, cookies, file trans-
   fer resume and more. As you will see below, the amount of features will
   make your head spin!

Ftp protocols (and there are more than one) are fiendishly complicated, 
especially if proxies are involved.


BTW, this is yet another case where knowing your OS would have helped 
give a more precise answer. See the posting guide.


On Thu, 8 Jan 2009, Thomas Loridan wrote:


Hi all,

I would like to upload some plots I create wth R via ftp or something
similar but I don t really understand which command/syntax I should
use:
should I go for  make.socket + write.socket or try and create
environment variables like frp_proxy_user and then ftp my files? how?

many thanks for your help

Thomas

--
Thomas Loridan
King's College email: thomas.lori...@kcl.ac.uk
webpage:http://geography.kcl.ac.uk/micromet/tloridan/index.htm

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



--
Brian D. Ripley,  rip...@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, UKFax:  +44 1865 272595

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R in the NY Times

2009-01-08 Thread Doran, Harold
The open-source mentality is invaluable, as most on this list know. That
is what keeps the R evolution progressing at a pace that SAS cannot keep
up with. 

On a side note (a very side note), I am a zealot for an exercise program
called Crossfit. Crossfit has adopted the same open-source mentality as
found in the Linux model and has grown into the most valuable fitness
and strength training program on the planet. There is an online journal
(called crossfit journal)
http://library.crossfit.com/free/pdf/CrossFitJournal-Budding_Retrospecti
ve.pdf that lists the three components of the linux open-source model:

The Linux development model:
* Release early and often
* Delegate everything you can
* Be open to the point of promiscuity

Crossfit then followed with its own open-source principles:

The CrossFit development model:
* Release early and often
- Daily!
* Delegate everything you can
- Meet the experts from the realms of climbing, lifting, swimming,
gymnastics, fighting, you name it.
* Be open to the point of promiscuity
- Read the WOD weblog comments.
- Check out the discussion board.
- See photos of athletes puking!

The point being, it is not the program itself that is amazing, but the
people that have made serious contributions to it that make it so. In
the same vein, R is only a representation of the many, many valuable
talented people who are constantly adding to its functionality because
of its open-source nature. That is, R itself is good, useful etc. But,
it is the people that add to it and help it grow as a scientific tool
that keep it as the lingua franca.







> -Original Message-
> From: r-help-boun...@r-project.org 
> [mailto:r-help-boun...@r-project.org] On Behalf Of Max Kuhn
> Sent: Thursday, January 08, 2009 10:17 AM
> To: r-help@r-project.org
> Subject: Re: [R] R in the NY Times
> 
> More commentary on Slashdot:
> 
>  http://developers.slashdot.org/article.pl?sid=09/01/07/2316227
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] xtable-longtable question

2009-01-08 Thread Felipe Carrillo
Thanks Duncan, I'll try that with my data.

--- On Wed, 1/7/09, Duncan Mackay  wrote:

> From: Duncan Mackay 
> Subject: Re: [R] xtable-longtable question
> To: mazatlanmex...@yahoo.com
> Cc: r-help@r-project.org
> Date: Wednesday, January 7, 2009, 1:15 PM
> I use Sweave and longtable but have not used them together.
> 
> It can be done but you may find the package booktabs
> helpful for headers 
> and footers for longtable and tables
> as it allows you to put different first and last page
> headers to the rest. 
> Something like (untested)
> PS You do not need to put \set longtables or something
> like that if you 
> have the latest longtable package as it is no longer
> required
> 
> % all table headers
> \toprule
> \addlinespace[3pt]
> \multicolumn{1}{c}{colname 1} & ...\\
> \midrule
> \addlinespace[3pt]
> \endhead
> 
> % if want different first 1
> \toprule
> \addlinespace[3pt]
> \multicolumn{1}{c}{colname 1} & ...\\
> \midrule
> \addlinespace[3pt]
> \endfirsthead
> 
> % last footer
> \bottomrule
> \endlastfoot
> 
> % other footers
> \addlinespace[5pt]
> \multicolumn{3}{r}{Continued next page}\\
> \midrule
> \endfoot
> 
> Regards
> 
> Duncan Mackay
> Department of Agronomy and Soil Science
> University of New England
> ARMIDALE NSW 2351
> Email (home): mac...@northnet.com.au
> 
> At 05:31 8/01/2009, you wrote:
> >Hello:
> >I am using Sweave to generate a PDF with figures and
> tables and was 
> >wondering if is possible to carry on table headers and
> some kind of 
> >caption like 'Continued' to the next PDF page
> when creating long tables.
> >
> >Felipe D. Carrillo
> >Supervisory Fishery Biologist
> >Department of the Interior
> >US Fish & Wildlife Service
> >California, USA
> >
> >__
> >R-help@r-project.org mailing list
> >https://stat.ethz.ch/mailman/listinfo/r-help
> >PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> >and provide commented, minimal, self-contained,
> reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] ftp connections for uploading files

2009-01-08 Thread Thomas Loridan
Hi all,

I would like to upload some plots I create wth R via ftp or something
similar but I don t really understand which command/syntax I should
use:
should I go for  make.socket + write.socket or try and create
environment variables like frp_proxy_user and then ftp my files? how?

many thanks for your help

Thomas

-- 
Thomas Loridan
King's College email: thomas.lori...@kcl.ac.uk
webpage:http://geography.kcl.ac.uk/micromet/tloridan/index.htm

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R in the NY Times

2009-01-08 Thread Max Kuhn
More commentary on Slashdot:

 http://developers.slashdot.org/article.pl?sid=09/01/07/2316227

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] NAs are not allowed in subscripted assignments

2009-01-08 Thread Rune Schjellerup Philosof
Browse[1]> j <- c(1,2,NA)
Browse[1]> j[j==1][-1]
[1] NA
Browse[1]> j[j==1][-2]
[1] 1
Browse[1]> j[j==1][-2] <- 2
Error during wrapup: NAs are not allowed in subscripted assignments

As far as I can see, I have no NA in the lhs (not after the second
subscript anyway).
Besides, I have a single value on the rhs, so it should be allowed to
have NAs in the lhs, according to help(Extract).

What am I missing?
I can see no ambiguite as to what the result of those commands should be
(j == c(2,2,NA)).

-- 
Med venlig hilsen
Rune Schjellerup Philosof
Videnskabelig Assistent, Statistik, SDU

Telefon:  6550 3607
Email:rphilo...@health.sdu.dk
Adresse: J.B. Winsløwsvej 9, 5000 Odense C

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Reading UTF-8 from MySQL in Windows

2009-01-08 Thread Tomas Krilavičius

Dear R-help,

I am reading strings (varchar) from MySQL database
and instead of some characters get garbled chars.
Strings are encoded in UTF-8. I have tried to change
encoding in MySQL to latin7, but it does not help.

I was not able to find solution, how to get strings
in proper encoding/form.


-- OS
windows xp

-- R info
MySQL connection commands
library( RMySQL ) ## load RMySQL and DBI packages
drv <- dbDriver( "MySQL" )

> l10n_info()
$MBCS
[1] FALSE
$`UTF-8`
[1] FALSE
$`Latin-1`
[1] FALSE
$codepage
[1] 1257
> Sys.getlocale()
[1] 
"LC_COLLATE=Lithuanian_Lithuania.1257;LC_CTYPE=Lithuanian_Lithuania.1257;LC_MONETARY=Lithuanian_Lithuania.1257;LC_NUMERIC=C;LC_TIME=Lithuanian_Lithuania.1257"


> R.Version()
$platform
[1] "i386-pc-mingw32"
$arch
[1] "i386"
$os
[1] "mingw32"
$system
[1] "i386, mingw32"
$status
[1] ""
$major
[1] "2"
$minor
[1] "8.0"
$year
[1] "2008"
$month
[1] "10"
$day
[1] "20"
$`svn rev`
[1] "46754"
$language
[1] "R"
$version.string
[1] "R version 2.8.0 (2008-10-20)"

--
regards,
tomas krilavičius
http://www.surface.lt/krilaviciust

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Faster Printing Alternatives to 'cat'

2009-01-08 Thread jim holtman
Here is one way of doing it.  To write out 1 million rows on my system
took 21 seconds.

> # create some data
> dataSize <- 1e6
> foo <- runif(dataSize)
> bar <- runif(dataSize)
> n <- 1000  # number of items to write out each time
> output <- file('/output.txt', 'w')
> # now split the indices into groups of 'n'
> index <- split(seq(length(foo)), cut(seq(length(foo)), length(foo) / n, 
> labels=FALSE))
> my.stats(reset=TRUE)
stats (1) - Rgui : <0.0 0.0> 73738.9 : 185.1MB
> for (i in index){
+ write.table(cbind(foo[i], bar[i]), file=output, sep='\t',
col.names=FALSE, row.names=FALSE)
+ }
> close(output)
> my.stats('done')
done (1) - Rgui : <20.7 20.7> 73759.6 : 124.6MB
>>

On Thu, Jan 8, 2009 at 8:26 AM, Gundala Viswanath  wrote:
> Dear Jim and Henrik,
>
>> What exactly is the problem you are trying to solve.
>> Is it going to be read by some other program?
>
> I  simply want to print the data out. Surely, this data
> will be manipulated (with Excel or other
> programming languages) by other people suit to their purpose.
>
> Typically the print out from the loop looks  like this:
>
> ATCGATCGATCGGGTTTGCGGG   10   11.992
> GGGCCATCGGTCAGGGAATTGACGGAA   2  0.222
> .
> up to ~16 million lines.
>
>> How much physical memory do you have on your machine?
> 6GB
>
>>  Is there paging  occuring due to the size of the objects?
> Don't quite understand what do you mean by that
> So sorry for my lack of knowledge in R.
>
>>  Have you consider creating a  structure with 10,000 of the variables
>> each time through the loop and then writing them out?
>
> Never thought about that. Can you be specific how can this be achieved?
>
> - Gundala Viswanath
> Jakarta - Indonesia
>
>
>
> On Thu, Jan 8, 2009 at 10:10 PM, jim holtman  wrote:
>> What exactly is the problem you are trying to solve.  What is going to
>> be done with the data?  Is it going to be read by some other program?
>> How much physical memory do you have on your machine?  Is there paging
>> occuring due to the size of the objects?  Have you consider creating a
>> structure with 10,000 of the variables each time through the loop and
>> then writing them out?  A lot will depend on how much free memory you
>> have.  I will also ask one of my favorite questions; "tell me what you
>> want to do, not how you want to do it".
>>
>> On Thu, Jan 8, 2009 at 6:12 AM, Gundala Viswanath  wrote:
>>> Dear all,
>>>
>>> I found that printing with 'cat' is very slow.
>>>
>>> For example in my machine this snippet
>>>
>>> __BEGIN__
>>>
>>> # I need to resolve to use this type of loop.
>>> # because using write(), I need to create a matrix  which
>>> # consumes so much memory. Note that "foo, bar, qux" object
>>> # is already very large (>2Gb)
>>>
>>> for ( s in 1:length(x) ) {
>>>cat(as.character(foo[s]),"\t",bar[s],"\t", qux[s],"\n")
>>> }
>>> __END__
>>>
>>> for "x" of size ~1.5million, takes more than 10 hours to print.
>>> On my Linux 1994.MHz AMD processor.
>>>
>>> Is there any faster alternatives to "cat" ?
>>>
>>>
>>> - Gundala Viswanath
>>> Jakarta - Indonesia
>>>
>>> __
>>> R-help@r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>
>>
>>
>> --
>> Jim Holtman
>> Cincinnati, OH
>> +1 513 646 9390
>>
>> What is the problem that you are trying to solve?
>>
>



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

What is the problem that you are trying to solve?

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Dataframe with unequal rows

2009-01-08 Thread David Winsemius
I doubt that you have a dataframe with those features, since R would  
not allow such an event; more likely you have data in a file. If your  
goal is to determine the number of items, then you should definitely  
look at:


?count.fields

count.fields(filename, sep=",")  # would give you 1 + the number  
commas in each line of the file


--
David Winsemius

On Jan 8, 2009, at 4:38 AM,  > wrote:



I have a data frame with unequal rows length separated by comma.I
have to read the data first and then calculate number of comma in each
row...how can I do that

Regards Rahul

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R in the NY Times

2009-01-08 Thread Marc Schwartz
on 01/07/2009 09:47 PM Gabor Grothendieck wrote:
> On Wed, Jan 7, 2009 at 10:26 PM, Dirk Eddelbuettel  wrote:
>> On 7 January 2009 at 18:24, Gabor Grothendieck wrote:
>> | By running the code below we see that the:
>> | - sum of the three seems to be rising at a constant rate
>> | - S is declining
>> | - SAS and R are rising
>> | - R is rising the fastest through its completed its phase
>> | of highest growth which ended around 2004
>>
>> I wonder whether we need to account for traffic on all the additional r-sig-*
>> mailing lists ?
>>
>> Of the handful that I follow, some seem to have taken traffic from r-help.
>> This could account for (at least parts of) the apparent traffic growth
>> slowdown since 2004 as many of these added lists appeared only in the last
>> few years.
>>
> 
> Good observation.  It would be interesting to combine the data from all
> the lists to see what the effect is.

Agreed.

You can use the basic framework of the R-Help code that I posted
yesterday to do that.

The key gotcha is that some of the list archives have the posts stored
on a per calendar quarter basis, not monthly. At least one has a mix.
This seems to be somewhat dependent upon list volume, though that is not
a consistent factor.

Thus, you would have to review each archive individually and adjust the
archive URL's in the code accordingly.

You would also see the impact on the subsequent aggregation of the data,
since the monthly time series based analyses (as opposed to yearly) will
have to be adjusted, given the differing granularity of the data.

HTH,

Marc

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Faster Printing Alternatives to 'cat'

2009-01-08 Thread Petr PIKAL
Hi

r-help-boun...@r-project.org napsal dne 08.01.2009 14:26:32:

> Dear Jim and Henrik,
> 
> > What exactly is the problem you are trying to solve.
> > Is it going to be read by some other program?
> 
> I  simply want to print the data out. Surely, this data
> will be manipulated (with Excel or other
> programming languages) by other people suit to their purpose.
> 
> Typically the print out from the loop looks  like this:
> 
> ATCGATCGATCGGGTTTGCGGG   10   11.992
> GGGCCATCGGTCAGGGAATTGACGGAA   2  0.222
> .
> up to ~16 million lines.

Just curious. Can Excel manipulate 16 mil lines?

> 
> > How much physical memory do you have on your machine?
> 6GB
> 
> >  Is there paging  occuring due to the size of the objects?
> Don't quite understand what do you mean by that
> So sorry for my lack of knowledge in R.
> 
> >  Have you consider creating a  structure with 10,000 of the variables
> > each time through the loop and then writing them out?
> 
> Never thought about that. Can you be specific how can this be achieved?

declare an object
make a loop
fill an object inside loop
output this object into a file e.g. by write.table
start again with new part of your data

Regards
Petr

> 
> - Gundala Viswanath
> Jakarta - Indonesia
> 
> 
> 
> On Thu, Jan 8, 2009 at 10:10 PM, jim holtman  wrote:
> > What exactly is the problem you are trying to solve.  What is going to
> > be done with the data?  Is it going to be read by some other program?
> > How much physical memory do you have on your machine?  Is there paging
> > occuring due to the size of the objects?  Have you consider creating a
> > structure with 10,000 of the variables each time through the loop and
> > then writing them out?  A lot will depend on how much free memory you
> > have.  I will also ask one of my favorite questions; "tell me what you
> > want to do, not how you want to do it".
> >
> > On Thu, Jan 8, 2009 at 6:12 AM, Gundala Viswanath  
wrote:
> >> Dear all,
> >>
> >> I found that printing with 'cat' is very slow.
> >>
> >> For example in my machine this snippet
> >>
> >> __BEGIN__
> >>
> >> # I need to resolve to use this type of loop.
> >> # because using write(), I need to create a matrix  which
> >> # consumes so much memory. Note that "foo, bar, qux" object
> >> # is already very large (>2Gb)
> >>
> >> for ( s in 1:length(x) ) {
> >>cat(as.character(foo[s]),"\t",bar[s],"\t", qux[s],"\n")
> >> }
> >> __END__
> >>
> >> for "x" of size ~1.5million, takes more than 10 hours to print.
> >> On my Linux 1994.MHz AMD processor.
> >>
> >> Is there any faster alternatives to "cat" ?
> >>
> >>
> >> - Gundala Viswanath
> >> Jakarta - Indonesia
> >>
> >> __
> >> R-help@r-project.org mailing list
> >> https://stat.ethz.ch/mailman/listinfo/r-help
> >> PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
> >> and provide commented, minimal, self-contained, reproducible code.
> >>
> >
> >
> >
> > --
> > Jim Holtman
> > Cincinnati, OH
> > +1 513 646 9390
> >
> > What is the problem that you are trying to solve?
> >
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Faster Printing Alternatives to 'cat'

2009-01-08 Thread ONKELINX, Thierry
Yoo should have a look at ?write.table

dataset <- cbind(foo, bar, qux)
#write to a file
write.table(x = dataset, file = "your_file_name.txt", sep = "\t",
row.names = FALSE)
#wrfite to the console
write.table(x = dataset, file = "", sep = "\t", row.names = FALSE)

HTH,

Thierry 




ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium 
tel. + 32 54/436 185
thierry.onkel...@inbo.be 
www.inbo.be 

To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to
say what the experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of
data.
~ John Tukey

-Oorspronkelijk bericht-
Van: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
Namens Gundala Viswanath
Verzonden: donderdag 8 januari 2009 14:27
Aan: jim holtman
CC: r-h...@stat.math.ethz.ch
Onderwerp: Re: [R] Faster Printing Alternatives to 'cat'

Dear Jim and Henrik,

> What exactly is the problem you are trying to solve.
> Is it going to be read by some other program?

I  simply want to print the data out. Surely, this data
will be manipulated (with Excel or other
programming languages) by other people suit to their purpose.

Typically the print out from the loop looks  like this:

ATCGATCGATCGGGTTTGCGGG   10   11.992
GGGCCATCGGTCAGGGAATTGACGGAA   2  0.222
.
up to ~16 million lines.

> How much physical memory do you have on your machine?
6GB

>  Is there paging  occuring due to the size of the objects?
Don't quite understand what do you mean by that
So sorry for my lack of knowledge in R.

>  Have you consider creating a  structure with 10,000 of the variables
> each time through the loop and then writing them out?

Never thought about that. Can you be specific how can this be achieved?

- Gundala Viswanath
Jakarta - Indonesia



On Thu, Jan 8, 2009 at 10:10 PM, jim holtman  wrote:
> What exactly is the problem you are trying to solve.  What is going to
> be done with the data?  Is it going to be read by some other program?
> How much physical memory do you have on your machine?  Is there paging
> occuring due to the size of the objects?  Have you consider creating a
> structure with 10,000 of the variables each time through the loop and
> then writing them out?  A lot will depend on how much free memory you
> have.  I will also ask one of my favorite questions; "tell me what you
> want to do, not how you want to do it".
>
> On Thu, Jan 8, 2009 at 6:12 AM, Gundala Viswanath 
wrote:
>> Dear all,
>>
>> I found that printing with 'cat' is very slow.
>>
>> For example in my machine this snippet
>>
>> __BEGIN__
>>
>> # I need to resolve to use this type of loop.
>> # because using write(), I need to create a matrix  which
>> # consumes so much memory. Note that "foo, bar, qux" object
>> # is already very large (>2Gb)
>>
>> for ( s in 1:length(x) ) {
>>cat(as.character(foo[s]),"\t",bar[s],"\t", qux[s],"\n")
>> }
>> __END__
>>
>> for "x" of size ~1.5million, takes more than 10 hours to print.
>> On my Linux 1994.MHz AMD processor.
>>
>> Is there any faster alternatives to "cat" ?
>>
>>
>> - Gundala Viswanath
>> Jakarta - Indonesia
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>
>
> --
> Jim Holtman
> Cincinnati, OH
> +1 513 646 9390
>
> What is the problem that you are trying to solve?
>

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer 
en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is
door een geldig ondertekend document. The views expressed in  this message 
and any annex are purely those of the writer and may not be regarded as stating 
an official position of INBO, as long as the message is not confirmed by a duly 
signed document.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Faster Printing Alternatives to 'cat'

2009-01-08 Thread Gundala Viswanath
Dear Jim and Henrik,

> What exactly is the problem you are trying to solve.
> Is it going to be read by some other program?

I  simply want to print the data out. Surely, this data
will be manipulated (with Excel or other
programming languages) by other people suit to their purpose.

Typically the print out from the loop looks  like this:

ATCGATCGATCGGGTTTGCGGG   10   11.992
GGGCCATCGGTCAGGGAATTGACGGAA   2  0.222
.
up to ~16 million lines.

> How much physical memory do you have on your machine?
6GB

>  Is there paging  occuring due to the size of the objects?
Don't quite understand what do you mean by that
So sorry for my lack of knowledge in R.

>  Have you consider creating a  structure with 10,000 of the variables
> each time through the loop and then writing them out?

Never thought about that. Can you be specific how can this be achieved?

- Gundala Viswanath
Jakarta - Indonesia



On Thu, Jan 8, 2009 at 10:10 PM, jim holtman  wrote:
> What exactly is the problem you are trying to solve.  What is going to
> be done with the data?  Is it going to be read by some other program?
> How much physical memory do you have on your machine?  Is there paging
> occuring due to the size of the objects?  Have you consider creating a
> structure with 10,000 of the variables each time through the loop and
> then writing them out?  A lot will depend on how much free memory you
> have.  I will also ask one of my favorite questions; "tell me what you
> want to do, not how you want to do it".
>
> On Thu, Jan 8, 2009 at 6:12 AM, Gundala Viswanath  wrote:
>> Dear all,
>>
>> I found that printing with 'cat' is very slow.
>>
>> For example in my machine this snippet
>>
>> __BEGIN__
>>
>> # I need to resolve to use this type of loop.
>> # because using write(), I need to create a matrix  which
>> # consumes so much memory. Note that "foo, bar, qux" object
>> # is already very large (>2Gb)
>>
>> for ( s in 1:length(x) ) {
>>cat(as.character(foo[s]),"\t",bar[s],"\t", qux[s],"\n")
>> }
>> __END__
>>
>> for "x" of size ~1.5million, takes more than 10 hours to print.
>> On my Linux 1994.MHz AMD processor.
>>
>> Is there any faster alternatives to "cat" ?
>>
>>
>> - Gundala Viswanath
>> Jakarta - Indonesia
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>
>
> --
> Jim Holtman
> Cincinnati, OH
> +1 513 646 9390
>
> What is the problem that you are trying to solve?
>

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Faster Printing Alternatives to 'cat'

2009-01-08 Thread jim holtman
What exactly is the problem you are trying to solve.  What is going to
be done with the data?  Is it going to be read by some other program?
How much physical memory do you have on your machine?  Is there paging
occuring due to the size of the objects?  Have you consider creating a
structure with 10,000 of the variables each time through the loop and
then writing them out?  A lot will depend on how much free memory you
have.  I will also ask one of my favorite questions; "tell me what you
want to do, not how you want to do it".

On Thu, Jan 8, 2009 at 6:12 AM, Gundala Viswanath  wrote:
> Dear all,
>
> I found that printing with 'cat' is very slow.
>
> For example in my machine this snippet
>
> __BEGIN__
>
> # I need to resolve to use this type of loop.
> # because using write(), I need to create a matrix  which
> # consumes so much memory. Note that "foo, bar, qux" object
> # is already very large (>2Gb)
>
> for ( s in 1:length(x) ) {
>cat(as.character(foo[s]),"\t",bar[s],"\t", qux[s],"\n")
> }
> __END__
>
> for "x" of size ~1.5million, takes more than 10 hours to print.
> On my Linux 1994.MHz AMD processor.
>
> Is there any faster alternatives to "cat" ?
>
>
> - Gundala Viswanath
> Jakarta - Indonesia
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



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

What is the problem that you are trying to solve?

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] troubles performing Moran.I test

2009-01-08 Thread Roger Bivand
  agrar.uni-giessen.de> writes:

> 
> dear R users,
> 
> I have troubles performing Moran.I test as suggested on  
> http://www.ats.ucla.edu/stat/r/faq/morans_i.htm

Using the ape package which is written for a different application area is 
not necessarily a good idea - the web page you refer to also has basic
blunders, mainly calculating and using planar distances when spherical
were called for. You repeat this in your data. Distances should be measured
by Great Circle between geographical coordinates.

> 
> my spatial data are longitude and lattitide of communities. The  
> calculation of the inverse distance matrix according to the homepage  
> (using my data)
> 
...
> the data which might be spatially autocorrelated is LN(Unem05/Unem98,  
> the LN of the development in unemployment rates in the communities  
> between 1998 and 2005. 
> 
> I have 426 communities in total and I don's see what might be wrong  
> with the data...However, I have some NAs in there...
> when I try to perform the test using:
> 
> Moran.I(datAL$LN.Rt05.Rt98., ALdist.inv, na.rm=TRUE)

The function takes a number of short cuts that are not obvious without reading
the code, or possibly reading Gittleman & Kot - it performs a hidden row
standardisation of the weights.

If we start from ape's Moran.I() example:

set.seed(1)
tr <- rtree(30)
x <- rnorm(30)
w <- 1/cophenetic(tr)
diag(w) <- 0
Moran.I(x, w)

we can recreate the same results using:

library(spdep)
# convert w to a row standardised general weights object
lw <- mat2listw(w)
lwW <- nb2listw(lw$neighbours, glist=lw$weights, style="W")
moran.test(x, lwW, alternative="two.sided")

Note that spdep provides functions for calculating Great Circle distances, 
see dnearneigh() and nbdist().

> 
> I get the following error message:
> Fehler in if (obs <= ei) 2 * pv else 2 * (1 - pv) :
>Fehlender Wert, wo TRUE/FALSE nötig ist
> 
Inserting an NA into x:

is.na(x[5]) <- TRUE
Moran.I(x, w, na.rm=TRUE)

and

xc <- complete.cases(x)
wc <- w[xc, xc]
lwc <- mat2listw(wc)
lwWc <- nb2listw(lwc$neighbours, glist=lwc$weights, style="W")
moran.test(x[xc], lwWc, alternative="two.sided")

agree in the coefficient but not beyond that (ei is not for the correct n 
in Moran.I()). By the way, Moran's I really doesn't make sense for missing 
data. There is a provision in moran.test() for subsetting, but not for the 
general weights matrix you are using.


> can anyone give me a hint what is going wrong??

Since it isn't NA in your variable, it must be something else, so use 
debug(Moran.I) to see which of obs and/or ei are NAs in the line you quote.

Have you had the opportunity to review the Spatial task view on CRAN?
It is not impossible that it might shed some light on your problem, possibly
more than the authority you cite, including a link to the R-sig-geo list. 

Roger Bivand

> 
> many thanks in advance!!
> 
> Barbara

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Faster Printing Alternatives to 'cat'

2009-01-08 Thread Henrik Bengtsson
On Thu, Jan 8, 2009 at 3:12 AM, Gundala Viswanath  wrote:
> Dear all,
>
> I found that printing with 'cat' is very slow.
>
> For example in my machine this snippet
>
> __BEGIN__
>
> # I need to resolve to use this type of loop.
> # because using write(), I need to create a matrix  which
> # consumes so much memory. Note that "foo, bar, qux" object
> # is already very large (>2Gb)
>
> for ( s in 1:length(x) ) {
>cat(as.character(foo[s]),"\t",bar[s],"\t", qux[s],"\n")
> }
> __END__
>
> for "x" of size ~1.5million, takes more than 10 hours to print.
> On my Linux 1994.MHz AMD processor.

But that's nothing compared to how long it will take you to read it.

>
> Is there any faster alternatives to "cat" ?

What are you trying to achieve?  Writing the data to file?  Something like this?

strs <- paste(as.character(foo), bar, qux, sep="\t");
writeLines(strs, con="foo.txt");

See also help(write.table) and friends.

/Henrik

>
>
> - Gundala Viswanath
> Jakarta - Indonesia
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Faster Printing Alternatives to 'cat'

2009-01-08 Thread Gundala Viswanath
Dear all,

I found that printing with 'cat' is very slow.

For example in my machine this snippet

__BEGIN__

# I need to resolve to use this type of loop.
# because using write(), I need to create a matrix  which
# consumes so much memory. Note that "foo, bar, qux" object
# is already very large (>2Gb)

for ( s in 1:length(x) ) {
cat(as.character(foo[s]),"\t",bar[s],"\t", qux[s],"\n")
}
__END__

for "x" of size ~1.5million, takes more than 10 hours to print.
On my Linux 1994.MHz AMD processor.

Is there any faster alternatives to "cat" ?


- Gundala Viswanath
Jakarta - Indonesia

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] resolution (dpi) problem

2009-01-08 Thread Gabor Grothendieck
On Tue, Apr 29, 2008 at 7:56 AM, Ted Harding
 wrote:
> Certainly for Windows users, the suggested change could be
> wise, since Windows (for reasons best known to someone who
> should have known better) conceals the extension from the

I think the reason for hiding extensions is that its normally already
apparent from the icon what the extension is; however, it is
a security risk and I would definitely change the default to show
extensions on any system I was using.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] VaR-Monte carlo Simulation, Historic simulation, Variance-Covariance Simulation

2009-01-08 Thread Carlos J. Gil Bellosta
Yes, there are: replicate and quantile are your friends.

You will find better support in the R-Finance list, though.

Best regards,

Carlos J. Gil Bellosta
http://www.datanalytics.com


On Thu, 2009-01-08 at 01:36 -0800, Maithili Shiva wrote:
> Dear R helpers
> 
> Suppose I have a portfolio of securities with exposure to Equity, Bonds and 
> Forex (say $ 100 each). 
> 
> Is there any fucntion in R that will help me calculate Value at Risk (VaR) 
> using Monte carlo Simulation , Historic simulation and Variance - Covariance 
> Simulation.
> 
> 
> With regards
> 
> Maithili
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] library error on start up, error on update packages

2009-01-08 Thread Prof Brian Ripley
Please do read the rw-FAQ (as requested in the posting guide): it will 
enlighten you.


On Wed, 7 Jan 2009, Greg Blevins wrote:


Hello,

I am unable to update packages.  I am running R version 2.8.1 (2008-12-22)
under VISTA.  When I start R I get the following error:


I presume that is *Windows* Vista (not capitalized)?


Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

Error in library(package, lib.loc = lib.loc, character.only = TRUE,
logical.return = TRUE,  :
 'datasets' is not a valid package -- installed < 2.0.0?


That seems to indicate you have a corrupt installation: we provide ways to 
check that too (see the rw-FAW).



Then, at the > when I run Update packages I get this error: Error: could not
find function "update.packages"

In R 2.8.0 I do not get either of the above errors that I get in 2.8.1, but
when I update packages in 2.8.0 I get the following warnings:

package 'lattice' successfully unpacked and MD5 sums checked
Warning: cannot remove prior installation of package 'lattice'
package 'mgcv' successfully unpacked and MD5 sums checked
Warning: cannot remove prior installation of package 'mgcv'
package 'nlme' successfully unpacked and MD5 sums checked
Warning: cannot remove prior installation of package 'nlme'
package 'rpart' successfully unpacked and MD5 sums checked
Warning: cannot remove prior installation of package 'rpart'

The downloaded packages are in
   C:\Users\Greg\AppData\Local\Temp\Rtmpyqi9OE\downloaded_packages
updating HTML package descriptions
Warning message:
In file.create(f.tg) :
 cannot create file 'C:\PROGRA~1\R\R-28~1.0/doc/html/packages.html', reason
'Permission denied'

Finally, as a side note, perhaps, I can install new packages using the
Install packages menu option under 2.8.1, but interestingly the newly
installed package does not appear under C:\Program
Files\R\R-2.8.1\Library--I have not found the location where the newly
installed package actually resides, but R is smart enough to locate it when
I load the package.

I am wondering if I have some VISTA setting or administrative rights issue?
Any help would be appreciated.

Greg Blevins


=
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.

Type 'q()' to quit R.

Error in library(package, lib.loc = lib.loc, character.only = TRUE,
logical.return = TRUE,  :
 'datasets' is not a valid package -- installed < 2.0.0?


update.packages(ask='graphics')

Error: could not find function "update.packages"



utils:::menuInstallPkgs()

--- Please select a CRAN mirror for use in this session ---
Error in install.packages(NULL, .libPaths()[1], dependencies = NA, type =
type) :
 no packages were specified

--
Gregory L. Blevins
Office 952 944-5743
Cell 612 251 0232
gregb...@gmail.com

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



--
Brian D. Ripley,  rip...@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, UKFax:  +44 1865 272595

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


  1   2   >