Re: [R] Function modification: how to calculate values for every combination?

2007-09-02 Thread Erich Neuwirth
outer(x,y,fun)

Lauri Nikkinen wrote:
> Hello,
> 
> I have a function like this:
> 
> fun <- function (x, y) {
>   a <- log(10)*y
>   b <- log(15)*x
>   extr <- a-b
>   extr
>   }
> 
> fun(2,3)
> [1] 1.491655
> 
> x <- c(1,2,3)
> y <- c(4,5,6)
> fun(x, y)
> [1] 6.502290 6.096825 5.691360
> 
> How do I have to modify my function that I can calculate results using
> every combination of x and y? I would like to produce a matrix which
> includes the calculated values in every cell and names(x) and names(y)
> as row and column headers respectively. Is the outer-function a way to
> solution?
> 
> Best regards,
> Lauri
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 
> 


-- 
Erich Neuwirth, University of Vienna
Faculty of Computer Science
Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-39464 Fax: +43-1-4277-39459

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


Re: [R] by group problem

2007-09-01 Thread Erich Neuwirth
Perhaps you want this?

data <- NULL
data$state <- c(rep("Illinois", 10), rep("Wisconsin", 10))
data$county <- c("Adams", "Brown", "Bureau", "Cass", "Champaign",
 "Christian", "Coles", "De Witt", "Douglas", "Edgar",
 "Adams", "Ashland", "Barron", "Bayfield", "Buffalo",
 "Burnett", "Chippewa", "Clark", "Columbia", "Crawford")
data$percentOld <- c(17.554849, 16.826594, 18.196593, 17.139242,  8.743823,
 17.862746, 13.747967, 16.626302, 15.258940, 18.984435,
 19.347022, 17.814436, 16.903067, 17.632781, 16.659305,
 20.337817, 14.293354, 17.252820, 15.647179, 16.825596)

data<-data.frame(data,stringsAsFactors=FALSE)
rankWithinState<-unlist(tapply(-data$percentOld,data$state,rank))
names(rankWithinState)<-NULL
data<-data.frame(data,rankWithinState)
highCounties<-data[data$rankWithinState<=5,]
highCountiesSorted<-highCounties[order(highCounties$state,-highCounties$percentOld),]

Cory Nissen wrote:
> I am working with census data.  My columns of interest are...
>  
> PercentOld - the percentage of people in each county that are over 65
> County - the county in each state
> State - the state in the US
-- 
Erich Neuwirth, University of Vienna
Faculty of Computer Science
Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-39464 Fax: +43-1-4277-39459

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


Re: [R] Excel

2007-08-31 Thread Erich Neuwirth
The quickest solution is to additionally install the package rcom from CRAN.
A more detailed account can be found on our wiki at
http://rcom.univie.ac.at
especially on
http://learnserver.csd.univie.ac.at/rcomwiki/doku.php?id=version_information_and_links


Greg Snow wrote:
> Erich,
> 
> I just downloaded the latest version of the R dcom server etc from CRAN
> (version 2.5, I had looked at the previous version, but wanted to try
> the latest version (I will be responding to your e-mail, just wanted to
> test some things rather than speak from ignorance (not that I always
> take that approach))).
> 
> When installing and further when running excel after the install I get
> an error and a visual basic debugger pops up.  The error window says:
> "Compile error: Can't find project or library", The code window is
> titled: "Rexcel.xla - MenuTools (Code)" and the line: "Function
> ExcelVersionMajor() As Integer" is highlighted in yellow, a couple of
> lines below that the word "Left" is highlighted/selected in the line
> "ExcelVersionMajor = Cint(Left(Application.Version, pos - 1))"
> 
> I have Excel 2000.
> 
> 
> 


-- 
Erich Neuwirth, University of Vienna
Faculty of Computer Science
Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-39464 Fax: +43-1-4277-39459

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


Re: [R] Excel

2007-08-31 Thread Erich Neuwirth
There is a hack to get around the problem.
It is definitely not a good solution, just a hack.

Open the .csv file in a text editor and select everything.
Paste it into an empty Excel sheet.
Then use Data -> Text to Columns

The third dialog box (at least it is the third one in Excel 2003)
allows you to format each column of the data. This is the place where
you can switch off the date interpretation of your ID column.

AUG1838 probably is not onterpreted as date because Excel dates only
start at 1/1/1900.


Duncan Murdoch wrote:
> On 8/28/2007 3:16 AM, J Dougherty wrote:
>> On Monday 27 August 2007 22:21, David Scott wrote:
>>> On Tue, 28 Aug 2007, Robert A LaBudde wrote:
>>>> If you format the column as "Text", you won't have this problem. By
>>>> leaving the cells as "General", you leave it up to Excel to guess at
>>>> the correct interpretation.
>>> Not true actually. I had converted the column to Text because I saw the
>>> interpretation as a date in the .xls file. I saved the .csv file *after*
>>> the column had been converted to Text. Looking at the .csv file in a text
>>> editor, the entry is correct.
>>>
>>> I have just rechecked this.
>>>
>>> On reopening the .csv using Excel, the entry AUG2699 had been interpreted
>>> as a date, and was showing as Aug-99. Most bizarre is that the NHI value
>>> of AUG1838 has *not* been interpreted as a date.
>>>

-- 
Erich Neuwirth, University of Vienna
Faculty of Computer Science
Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-39464 Fax: +43-1-4277-39459

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


Re: [R] Stratified weighted statistics

2007-08-29 Thread Erich Neuwirth
In the help file for summarize
in the examples section search for the following line

# Get stratified weighted means

Vikas Rawal wrote:
>> Please look again at the help files for summarize and wtd.mean which 
>> show how to do this.

-- 
Erich Neuwirth, University of Vienna
Faculty of Computer Science
Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-39464 Fax: +43-1-4277-39459

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


Re: [R] Excel

2007-08-29 Thread Erich Neuwirth
y easy to create a similar table just by having a quick look at
the original table.

Of course it is possible to design terrible spreadsheets.
But it is also quite possible to write terrible R code.

What makes spreadsheets very special is autorecalculation and
autoupdating of charts, but also the point-and-click method of creating
formulas (using relative and absolute references).

And of course, knowing one tool always is dangerous, but this is also
true in the case where the single known tool is R.


-- Erich Neuwirth, University of Vienna Faculty of Computer Science
Computer Supported Didactics Working Group Visit our SunSITE at
http://sunsite.univie.ac.at Phone: +43-1-4277-39464 Fax: +43-1-4277-39459
-- 
Erich Neuwirth, University of Vienna
Faculty of Computer Science
Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-39464 Fax: +43-1-4277-39459

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


Re: [R] Excel

2007-08-29 Thread Erich Neuwirth
Excel bashing can be fun but also can be dangerous because
you are makeing your life harder than necessary.
Statisticians meanwhile know that the numerics of statistical
computation can be quite bad, therefore one should not use them.
But using our (we = Thomas Baier + Erich Neuwirth) RExcel addin either
with the R(D)COM server or with rcom (package on CRAN) allows you to use
all the nice features of Excel (yes, there are quite a few) and use R as
as the computational engine within Excel. The formula
=RApply("var",A1:A1000) in an Excel cell for example will use R to
compute the variance of the data in column A in Excel. If you change any
of the values in the range A1:A1000 will automatically recompute the
variance.

There is one feature in Excel which is extremely convenient, Pivot
tables. Anybody doing any work as statistical consultant really ought to
know about Pivot tables, and I am still surprised how many statisticians
do not know about it. Neither Gnumeric nor OpenOffice Calc offer
comparably convenient ways working with multidimensional tables.

I think the answer to the question
"Excel or R" of course is "Excel and R".



-- 
Erich Neuwirth, University of Vienna
Faculty of Computer Science
Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-39464 Fax: +43-1-4277-39459

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


Re: [R] help and Firefox

2007-08-15 Thread Erich Neuwirth
I found a solution to my problem.
It is describe here.
http://kb.mozillazine.org/Windows_error_opening_Internet_shortcut_or_local_HTML_file_-_Firefox

Essentially, it involves switching off DDE for some file associations
in Windows Explorer.

It really is a Firefox bug.


Erich Neuwirth wrote:
> My configuration is  Windows XP, R-2.5.1patched.
> My standard browser in Windows is Firefox 2.0.6,
> and I am using htmlhelp.
> I have problems with starting the browser for displaying help.
> help("lm") works as it should when Firefox is already running.
> When I do help("lm") and the browser is not yet started,
> I get
> Error in shell.exec(url) :
> 'C:\PROGRA~2\R\R-25~1.1\library\stats\html\lm.html' not found
> but nevertheless the browser starts and the html file is displayed
> some seconds later.
> 
> If I try to use help from within a function and the browser is not open,
> the browser will not start and therefore help will not be displayed.
> 
> Has anybody else experienced the same problem?
> Is there a solution?
> 
> 


-- 
Erich Neuwirth, University of Vienna
Faculty of Computer Science
Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-39464 Fax: +43-1-4277-39459

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


[R] help and Firefox

2007-08-15 Thread Erich Neuwirth
My configuration is  Windows XP, R-2.5.1patched.
My standard browser in Windows is Firefox 2.0.6,
and I am using htmlhelp.
I have problems with starting the browser for displaying help.
help("lm") works as it should when Firefox is already running.
When I do help("lm") and the browser is not yet started,
I get
Error in shell.exec(url) :
'C:\PROGRA~2\R\R-25~1.1\library\stats\html\lm.html' not found
but nevertheless the browser starts and the html file is displayed
some seconds later.

If I try to use help from within a function and the browser is not open,
the browser will not start and therefore help will not be displayed.

Has anybody else experienced the same problem?
Is there a solution?


-- 
Erich Neuwirth, University of Vienna
Faculty of Computer Science
Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-39464 Fax: +43-1-4277-39459

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


Re: [R] shell and shell.exec on Windows

2007-08-11 Thread Erich Neuwirth
Thanks Gabor,
system() indeed would be the answer, but it does not solve my problem
because of some inconsistencies in WindowsXP.
I will explain the story, because perhaps it can help somebody else to
avoid wasting time.
On my machine, when I doubleclick an .xlsm file, it is opened in Excel
2007. .xls files are opened in Excel 2003.
shell.exec("file.xls") and shell.exec("file.xlsm")
also open the files in Excel 2003 and Excel 2007 respectively.

system() does not invoke a shell, so I need to find the application
associated with Excel to create a string with the name
of the application and the name of the file to open.
Then, something like
system("\"c:\\mypath\\CorrectVersionOfExcel.exe\"
\"c:\\mydir\\myexcelfile.xlsm\"")
should work (and run the program invisibly)

There are two helpful shell commands in WinXP
ASSOC and FTYPE

ASSOC .xls
   .xls=Excel.Sheet.8

ASSOC .xlsm
   .xlsm=Excel.SheetMacroEnabled.12

ftype Excel.Sheet.8
  Excel.Sheet.8="C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE" /e

ftype Excel.SheetMacroEnabled.12
  Excel.SheetMacroEnabled.12="C:\PROGRA~2\MICROS~2\OFFICE11\EXCEL.EXE" /e

So despite the fact that doubleclicking .xlsm files or using
"shell.exec" opens Excel 2007
the application reported by assoc and ftype for .xlsm files is Excel 2003.


Gabor Grothendieck wrote:
> The system() function has an invisible= argument.  The ryacas package
> uses system() to run yacas.  See the runYacas() and
> yacasInvokeString() functions in yacas.R for examples:
>http://ryacas.googlecode.com/svn/trunk/R/yacas.R
> 
> On 8/11/07, Erich Neuwirth <[EMAIL PROTECTED]> wrote:
>> I have an Excel workbook "MyWorkbook.xls" containing an Auto_Open macro
>> which I want to be run from R.
>>
>> shell.exec("MyWorkbook.xls")
>> does that.
>>
>> shell("start MyWorkbook.xls")
>> also runs it.
>>
>> In both cases, the Excel window is visible on screen when Excel is started.
>> Is there a way of opening the sheet with a hidden Excel window?
>> start has some parameters (e.g. /MIN), which should allow this, but
>> shell("start /MIN MyWorkbook.xls")
>> also starts Excel visibly.
>>
>>
>>
>> --
>> Erich Neuwirth, University of Vienna
>> Faculty of Computer Science
>> Computer Supported Didactics Working Group
>> Visit our SunSITE at http://sunsite.univie.ac.at
>> Phone: +43-1-4277-39464 Fax: +43-1-4277-39459
>>
>> ______
>> R-help@stat.math.ethz.ch mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
> 
> 


-- 
Erich Neuwirth, University of Vienna
Faculty of Computer Science
Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-39464 Fax: +43-1-4277-39459

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


[R] shell and shell.exec on Windows

2007-08-11 Thread Erich Neuwirth
I have an Excel workbook "MyWorkbook.xls" containing an Auto_Open macro
which I want to be run from R.

shell.exec("MyWorkbook.xls")
does that.

shell("start MyWorkbook.xls")
also runs it.

In both cases, the Excel window is visible on screen when Excel is started.
Is there a way of opening the sheet with a hidden Excel window?
start has some parameters (e.g. /MIN), which should allow this, but
shell("start /MIN MyWorkbook.xls")
also starts Excel visibly.



-- 
Erich Neuwirth, University of Vienna
Faculty of Computer Science
Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-39464 Fax: +43-1-4277-39459

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


Re: [R] R-excel

2007-06-25 Thread Erich Neuwirth
The R(D)COM server (contaiong the RExcel Excel addin) and/or the rcom
package allow (among other things) to select a range in Excel and
directly transfer it to R as an array or as a dataframe.
It only works on Windows with Excel and R installed.

More information on these packages is available at

http://rcom.univie.ac.at


Erika Frigo wrote:
> Good morning to everybody,
> I have a problem : how can I import excel files in R???
> 
> thank you very much
> 
> 
> Dr.sa. Erika Frigo
> Università degli Studi di Milano
> Facoltà di Medicina Veterinaria
> Dipartimento di Scienze e Tecnologie Veterinarie per la Sicurezza Alimentare 
> (VSA)
>  
> Via Grasselli, 7
> 20137 Milano
> Tel. 02/50318515
> Fax 02/50318501
>   [[alternative HTML version deleted]]
> 
> 
> 
> 
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

-- 
Erich Neuwirth, Didactic Center for Computer Science
University of Vienna
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-39464 Fax: +43-1-4277-9394

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


[R] accessing unexported functions

2007-05-21 Thread Erich Neuwirth
I need to access some internal function of a package temporarily.
These functions normally that are not visible outside of the package.
I know the MyPackage:::myfunction mechanism,
but that does not solve my problem.
Instead, I need to add the "internal namespace" of the package
to the search path, then I can run a few commands with these functions
available, and then the internal namespace should become
invisible again.

Is there a code example to achieve this?


-- 
Erich Neuwirth, Didactic Center for Computer Science
University of Vienna
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-39464 Fax: +43-1-4277-9394

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


[R] Centering a legend

2007-05-07 Thread Erich Neuwirth
Using layout I am plotting 5 boxplots on top of each other,
all of them using colored boxes in different order.
In a 6th box below I want to give the legend explaining the box colors,
and I want this box to be centered in an otherwise empty plot.
I am creating this plot by
plot(0:1,0:1,type="n")

Is there an easy way to find the parameters x and y for calling legend
which will center the legend in this plot?



-- 
Erich Neuwirth, University of Vienna
Faculty of Computer Science
Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-39464 Fax: +43-1-4277-39459

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


Re: [R] importing excel-file

2007-04-20 Thread Erich Neuwirth
I am coming in late in this discussion because I am away from home and
do not read my email regularly. Here are my few cents.

If you are working on Windows and have Excel installed,
an easy way of transferring data between R and Excel is my RExcel
package which ships with Thomas Baier's R(D)COM package, and also can be
used with Thomas' rcom package.

rcom is available as a package from CRAN and can be installed from the
package menu in RGui.

R(D)COM is available from CRAN in section Other. You have to download it
and run the installer program (and you need admin rights to be able to
do this).

If you use rcom, you should have R and Excel open simultaneously.
Then, just select a range in Excel, right-click any cell in the range,
and click on "Put Dataframe" in the context menu that pops up.
Your data are immediately transferred to R as a dataframe (you choose
that name, or RExcel uses the Excel file name or the worksheet name).

The main difference between the R(D)COM server and the rcom package is
that with rcom RGui is visible, so you can switch between R and Excel.
With R(D)COM, you have R in the background.

There is a mailing list, for all rcom and R(D)COM related questions,
you can subscribe by way of the rcom web server,
http://rcom.univie.ac.at (the link to the mailing list is there).



Schmitt, Corinna wrote:
> Dear R-experts,
> 
> It is a quite stupid question but please help me. I am very confuced. I
> am able to import normal txt ant mat-files to R but unable to import
> .xls-file
> 
> I do not understand the online help. Can please anyone send me the
> corresponding command lines? The .xls-file is attached. In my file we
> use commas for the decimal format (example: 0,712), changes might be
> needed.
> 
> Thanks, Corinna
> 
> 
> 
> 
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

-- 
Erich Neuwirth, Didactic Center for Computer Science
University of Vienna
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-39464 Fax: +43-1-4277-9394

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


Re: [R] Integration + Normal Distribution + Directory Browsing Processing Questions

2007-01-22 Thread Erich Neuwirth
Nils Hoeller wrote:
> 
> for example.
> 
> BUT what can I do for dynamic m and sd?
> I want something like integrate(dnorm(,0.6,0.15),0,1), with the first 
> dnorm parameter open for the
> integration but fixed m and sd.

integrate(function(x)dnorm(x,0.1,1.2), 0, 1)
is a way of "fixing" additional parameters.



-- 
Erich Neuwirth, University of Vienna
Faculty of Computer Science
Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-39464 Fax: +43-1-4277-39459

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


Re: [R] Calling R functions in Delphi

2006-12-06 Thread Erich Neuwirth
R(D)COM available from CRAN (section Other) gives you R as a COM server.
If Delphi can act as a COM client (which I think is true), you can
access R directly from within your program without the need to write files.



> Anna Belova wrote:
>> Hello All,
>>
>> We would like to call quantile() function from the R-package STATS in a
>> Delphi program. If this is possible, could anyone provide us with an
>> example?


-- 
Erich Neuwirth, University of Vienna
Faculty of Computer Science
Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-39464 Fax: +43-1-4277-39459

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


Re: [R] strange algorithm needed

2006-11-01 Thread Erich Neuwirth
1+(0:16 %% 3)
is a "purely arithmetic" solution

Dimitris Rizopoulos wrote:
> probably you want to use the 'length' argument of rep(), e.g.,
> 
> rep(1:3, length = 17)
> 
> 
> I hope it helps.
> 
> Best,
> Dimitris

-- 
Erich Neuwirth, University of Vienna
Faculty of Computer Science
Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-39464 Fax: +43-1-4277-39459

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


[R] Bitmap file size problems

2006-09-12 Thread Erich Neuwirth
I am experiencing some problems with the windows graphics device
and bitmaps. (Everything is done in R 2.3.1 on Windows XP)
As an example, I will use

windows(3,2)
plot(1:10)

It is not a pretty or meaningful graph, but it demonstrates the problem.

savePlot(file="test",type="bmp")

creates a bitmap file of size 303x207 which is somewhat strange
because it seems to use slightly different values for
pixels per inch horizontally and vertically.
(By the way, in my version of R 2.4.0alpha, the bitmap has size
303x206)
The documentation warns that the graphics devices use
pixel per inch values reported by Windows, and that might be unreliable.
In my case,

windows(3,2,xpinch=96)
plot(1:10)
savePlot(file="test",type="bmp")

produces the same image (of the same size) as before, so
Windows seems to report 96 for the pixels per inch value.
The next result surprised me:

windows(3,2,xpinch=96,ypinch=96)
plot(1:10)
savePlot(file="test",type="bmp")

produces a square graphics window and a bitmap file of size
303x303. (In R 2.4.0 alpha the size is 303x302).
In fact, when ypinch is given, height seems to be ignored
and the graphics windows height:width ratio is the
ypinch:xpinch ratio from the call to windows.
windows(10,1,xpinch=96,ypinch=192)

will produce a window which is higher than wide,
which is not what I expected after reading the docs.
(This also is true in R 2.4.0 alpha)

The alternative solution is to use dev2bitmap.

windows(3,2)
plot(1:10)
dev2bitmap(file="test.bmp",type="bmp256",width=3,height=2,res=100)

produces a bitmap of size 300x200 which is exactly what is to
be expected. In this bitmap, however, the leftmost
part of the image displayed in R's graphics window is cut off.

What is the best way of creating bitmaps of a given size
containing the full contents of an R  graphics window?



-- 
Erich Neuwirth, Didactic Center for Computer Science
University of Vienna
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-39464 Fax: +43-1-4277-9394

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


Re: [R] [Rcom-l] GARCH(1,1) optimization with R

2006-08-09 Thread Erich Neuwirth
This is not the right list for your question.
Question on how to use R and R's libraries should be posted to
R-help@stat.math.ethz.ch




Patrick Zhang wrote:
> Hello all,
> 
> Trying to implement GARCH(1,1) with ASP.NET <http://asp.net/> and
> VB.NET<http://vb.net/>.
> It involves optimization of a three-variate function with some constraints.
> Learned from Wilmott.com <http://wilmott.com/> that R might be able to
> do it
> but have no idea how.  Could anyone help me out please.  Thanks in advance.
> 
> Additional info:
> 1. Tried calling Excel Solver from within my web application - it works
> fine
> except that Excel.exe won't go away from task manager although the Quit()
> method has been used;
> 2. Also tried running (Process.Start) a separate console application that
> calls Excel Solver from the code, getting error message: The application
> failed to initialize properly (0xc142).
> Any thought of an alternative?
> 
> Best wishes,
> Pat
> 
> 
> 
> 
> ___
> Rcom-l mailing list
> [EMAIL PROTECTED]
> http://mailman.csd.univie.ac.at/mailman/listinfo/rcom-l
> Wiki at http://rcom.csd.univie.ac.at/rcomwiki/


-- 
Erich Neuwirth, Didactic Center for Computer Science
University of Vienna
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-39464 Fax: +43-1-4277-9394

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


Re: [R] Postscript fonts

2006-08-05 Thread Erich Neuwirth
Thanks,

The following piece of code demonstrates a problem I still have.

pdf(file="fonttest.pdf",fonts=c("Helvetica"))
plot(1:10,main="",xlab="")
par(family="Helvetica",font=1)
title(main="Helvetica")
par(family="Helvetica",font=2)
title(sub="Helvetica-Bold")
par(family="Helvetica",font=3)
title(xlab="Helvetica-Oblique")
dev.off()

The font=  parameter seems not to be respected.
I do not get bold or italics.
What am I doing wrong or not understand here?

My original problem was that I had not understood that the
fonts parameter is absolutely necessary when opening the device
when one wants to use par(family= ).


BTW, this is R 2.3.1 on Windows XP.



Prof Brian Ripley wrote:
> > On Sat, 5 Aug 2006, Erich Neuwirth wrote:
> >
>> >> How can I find out what fonts are available for
>> >> par(family=
>> >> for the postscript device?
> >
> > This is dynamic: for the current value
> >
>> >> names(postscriptFonts())
> >  [1] "serif""sans" "mono"
> >  [4] "symbol"   "AvantGarde"   "Bookman"
> >  [7] "Courier"  "Helvetica""Helvetica-Narrow"
> > [10] "NewCenturySchoolbook" "Palatino" "Times"
> > [13] "URWGothic""URWBookman"   "NimbusMon"
> > [16] "NimbusSan""URWHelvetica" "NimbusSanCond"
> > [19] "CenturySch"   "URWPalladio"  "NimbusRom"
> > [22] "URWTimes" "ComputerModern"
"ComputerModernItalic"
> > [25] "Japan1"   "Japan1HeiMin" "Japan1GothicBBB"
> > [28] "Japan1Ryumin" "Korea1"   "Korea1deb"
> > [31] "CNS1" "GB1"
> >
> > and for more details see the current R-News (6/2).
-- 
Erich Neuwirth, University of Vienna
Faculty of Computer Science
Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-39464 Fax: +43-1-4277-39459

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


[R] Postscript fonts

2006-08-04 Thread Erich Neuwirth
How can I find out what fonts are available for
par(family=
for the postscript device?



-- 
Erich Neuwirth, Didactic Center for Computer Science
University of Vienna
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-39464 Fax: +43-1-4277-9394

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


[R] Monospaced fonts in legends

2006-07-31 Thread Erich Neuwirth
Is there a way of using monospaced fonts in legends in a plot,
but still using standard proportionally spaced fonts for all the titles?


-- 
Erich Neuwirth, University of Vienna
Faculty of Computer Science
Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-39464 Fax: +43-1-4277-39459

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


Re: [R] Standard Deviation Distribution

2006-06-18 Thread Erich Neuwirth
[EMAIL PROTECTED] wrote:
> > sddist
>>> > >>
> > function(s,n) {
> > sig2 <- n*s*s/(n-1)
> > 2*(n/(2*sig2))^((n-1)/2) / gamma((n-1)/2) * exp(-n*s*s/(2*sig2)) *
s^(n-2)
> > }


There is another way using more statistical knowledge:
Building on functions already available in R
one may note that the easiest way of defining
sddist is

sddist<-function(s,n) dchisq(n*s^2,n-1)*2*n*s

Plotting this function for n in seq(2,12,2)
reproduces the graph in Mathworld.

The idea is the following:
given a random variable x with a chisquare distribution with
df n-1, s can be defined by s=sqrt(x/n) and therefore
x=n*s^2

If F and G are the cumulative distribution functions of x and s
and f and g are the density functions of x and s, then we have
G(s)=F(n*s^2) and therefore
g(s)=f(n*s^2)*2*n*s
-- 
Erich Neuwirth, University of Vienna
Faculty of Computer Science
Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-39464 Fax: +43-1-4277-39459

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


[R] namespace question

2006-05-01 Thread Erich Neuwirth
I need to modify the function "loess.smooth" from package stats
to accept an additional weight parameter.
I found the places where I need to change things,
but there is a problem remaining (in R 2.2.1).
loess.smooth contains the call

fit <- simpleLoess(y, x, w, span, degree, FALSE, FALSE,
   normalize=FALSE, "none", "interpolate",
   control$cell, iterations, control$trace.hat)

Since simpleLoess is not exported from stats,
I need to change this to

fit <- stats:::simpleLoess(y, x, w, span, degree, FALSE, FALSE,


Furthermore, simpleLoess does

z <- .C(R_loess_ifit,

Changing this to

z <- .C(stats:::R_loess_ifit,


solves the problem in R 2.3.0, but not in R 2.2.1
Is there an easy solution for 2.2.1 also?





-- 
Erich Neuwirth
Institute for Scientific Computing and
Didactic Center for Computer Science
University of Vienna
phone: +43-1-4277-39464  fax: +43-1-4277-39459

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


Re: [R] bivariate weighted kernel density estimator

2006-04-24 Thread Erich Neuwirth
Dear Roger,
thanks for the suggestion.
That is the solution, just modifying kde2d.
I did it slightly differently.
Since I have up to 20 points,
diag(Z) from your code becomes too large.
But since t(matrix(dnorm(ay),n,nx)) only needs to be
multiplied with the weights rowwise and
* applied to vectors repeats the shorter vector cyclically,
Z * t(matrix(dnorm(ay)))
does the same thing as
diag(Z) %*% t(matrix(dnorm(ay),n,nx))

and does not need too much memory.

I also have to add an excuse:
In the original posting I stated that I need WEIGHTED kernel
density estimators in the subject,
but did not mention weighted in the text.
That was imprecise and probably therefore I mislead some list
participants.

Erich


Roger Bivand wrote:
> kde2d.G is just kde2d with two changes - it takes the grid from the GRASS
> region, and it allows weights in the Z argument. Please have a look at
the
> code and see if you can't simply retro-fit it to kde2d:
>
> if (!is.null(Z)) {
> if (length(Z) != nx)
> stop("Data vectors must be the same length")
> z1 <- matrix(dnorm(ax), n, nx) %*% diag(Z) %*%
t(matrix(dnorm(ay),
> n, nx))/(nx * h[1] * h[2])
> z <- z1/z
> }
>
> This was put into the function to make a very crude kernel density
> interpolator with the grid cell values scaled in the units of the Z
> variable.
>

-- 
Erich Neuwirth, University of Vienna
Faculty of Computer Science
Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-39464 Fax: +43-1-4277-39459

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


[R] bivariate weighted kernel density estimator

2006-04-23 Thread Erich Neuwirth
Is there code for bivariate kernel density estimation?
For bivariate kernels there is
kde2d in MASS
kde2d.g in GRASS
KernSur in GenKern
(list probably incomplete)
but none of them seems to accept a weight parameter
(like density does since R 2.2.0)

-- 
Erich Neuwirth, University of Vienna
Faculty of Computer Science
Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-39464 Fax: +43-1-4277-39459

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


[R] rownames, colnames, and date and time

2006-03-21 Thread Erich Neuwirth
I noticed something surprising (in R 2.2.1 on WinXP)
According to the documentation, rownames and colnames are character vectors.
Assigning a vector of class POSIXct or POSIXlt as rownames or colnames
therefore is not strictly according to the rules.
In some cases, R performs a reasonable typecast, but in some other cases
where the same typecast also would be possible, it does not.

Assigning a vector of class POSIXct to the rownames or names of a
dataframe creates a reasonable string representation of the dates (and
possibly times).
Assigning such a vector to the rownames or colnames of a matrix produces
rownames or colnames consisting of the integer representation of the
date-time value.
Trying to assign a vector of class POSIXlt in all cases
(dataframes and matrices, rownames, colnames, names)
produces an error.

Demonstration code is given below.

This is somewhat inconsistent.
Perhaps a reasonable solution could be that the typecast
used for POSIXct and dataframes is used in all the other cases also.

Code:

mymat<-matrix(1:4,nrow=2,ncol=2)
mydf<-data.frame(mymat)
mydates<-as.POSIXct(c("2001-1-24","2005-12-25"))

rownames(mydf)<-mydates
names(mydf)<-mydates
rownames(mymat)<-mydates
colnames(mymat)<-mydates

print(deparse(mydates))
print(deparse(rownames(mydf)))
print(deparse(names(mydf)))
print(deparse(rownames(mymat)))
print(deparse(colnames(mymat)))

mydates1<-as.POSIXlt(mydates)

# the following lines will not work and
# produce errors

rownames(mydf)<-mydates1
names(mydf)<-mydates1
rownames(mymat)<-mydates1
colnames(mymat)<-mydates1


-- 
Erich Neuwirth
Institute for Scientific Computing and
Didactic Center for Computer Science
University of Vienna
phone: +43-1-4277-39464  fax: +43-1-4277-39459

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


[R] functional programming question

2006-02-04 Thread Erich Neuwirth
Many functional programming languages have a metafunction
which does the following:
it has two arguments, a function and a list of objects, all of the same
type.
The argument function itself has two arguments of the same type as all
the list objects, and the result of this function also is of the same type.
then
metafunction(f,list(x1,x2,xn)) produces
f(x1,f(x2,f(x3,,f(xn-1,xn)))..)
Does R have such a function, or do I need to code it myself?
In Scheme (Mathematica), this metafunction is called fold (Fold).


-- 
Erich Neuwirth, University of Vienna
Faculty of Computer Science
Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-39464 Fax: +43-1-4277-39459

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


Re: [R] html excel file

2006-01-19 Thread Erich Neuwirth


On Do, 19.01.2006, 10:38, Stefan Semmeling wrote:
> hallo,
>
> i have a problem reading in the above mentioned kind of a file.

One way of transferring data between R and Excel is using the
RExcel package contained in R(D)COM server available from CRAN
in category Other.

The package rcom (available from CRAN) can turn R into a COM server
for Excel and with a little bit of VBA programming it is possible
to transfer data both ways also.

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


[R] dataframes with only one variable

2006-01-12 Thread Erich Neuwirth
Subsetting from a dataframe with only one variable
returns a vector, not a dataframe.
This seems somewhat inconsistent.
Wouldn't it be better if subsetting would respect
the structure completely?


v1<-1:4
v2<-4:1
df1<-data.frame(v1)
df2<-data.frame(v1,v2)
sel1<-c(TRUE,TRUE,TRUE,TRUE)

> df1[sel1,]
[1] 1 2 3 4
> df2[sel1,]
  v1 v2
1  1  4
2  2  3
3  3  2
4  4  1

-- 
Erich Neuwirth
Institute for Scientific Computing and
Didactic Center for Computer Science
University of Vienna
phone: +43-1-4277-39464  fax: +43-1-4277-39459

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


Re: [R] convolution of the double exponential distribution

2005-12-23 Thread Erich Neuwirth
Mathematica says

Assuming[q ∈ Reals && q > 0, Integrate[(q + x)^n*Exp[-2*x], {x, 0,
Infinity}]]

2^(-1 - n)*Exp[2*q]*Gamma[1 + n, 2*q]

and 2-argument Gamma is the incomplete Gamma function
(integration starting at 2*q)


Duncan Murdoch wrote:
> On 12/22/2005 7:56 PM, Bickel, David wrote:
> 
>>Is there any R function that computes the convolution of the double
>>exponential distribution?
>>
>>If not, is there a good way to integrate ((q+x)^n)*exp(-2x) over x from
>>0 to Inf for any value of q and for any positive integer n? I need to
>>perform the integration within a function with q and n as arguments. The
>>function integrate() is giving me this message:
>>
>>"evaluation of function gave a result of wrong length"
> 
> 
> Under the substitution of y = q+x, that looks like a gamma integral. 
> The x = 0 to Inf range translates into y = q to Inf, so you'll need an 
> incomplete gamma function, such as pgamma.  Be careful to get the 
> constant multiplier right.
> 
> Duncan Murdoch
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> 
> 


-- 
Erich Neuwirth, University of Vienna
Faculty of Computer Science
Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-38624 Fax: +43-1-4277-9386

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

[R] Hiding a function from ls()

2005-12-22 Thread Erich Neuwirth
I need to define a small helper function
which should not be listed by ls().
What is the best and cleanest way of achieving this?

-- 
Erich Neuwirth, University of Vienna
Faculty of Computer Science
Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-38624 Fax: +43-1-4277-9386

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


[R] array indices in synced vectors

2005-09-08 Thread Erich Neuwirth
Let us start with the following definitions

xxx<-rep(c(1,2),times=5)
yyy<-rep(c(1,2),each=5)
a<-c(11,12)
b<-matrix(1:4,2,2)

a[xxx] produces
[1] 11 12 11 12 11 12 11 12 11 12

b[xxx,yyy] produces
  [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]111113333 3
 [2,]222224444 4
 [3,]111113333 3
 [4,]222224444 4
 [5,]111113333 3
 [6,]222224444 4
 [7,]111113333 3
 [8,]222224444 4
 [9,]111113333 3
[10,]222224444 4

so it does an implicit "outer" for the indices in xxx and yyy.

sapply(1:length(xxx),function(x)b[xxx[x],yyy[x]])
does what I need and produces
 [1] 1 2 1 2 1 4 3 4 3 4

Is there a function taking xxx,yyy, and b as arguments
producing the same result?

Essentially, I am asking for a version of lapply and/or sapply
which works with functions of more than one argument and takes the
iteration arguments as vectors or lists of equal length.




-- 
Erich Neuwirth, Didactic Center for Computer Science
University of Vienna
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-39902 Fax: +43-1-4277-9399

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


Re: [R] ScieViews installer

2005-05-07 Thread Erich Neuwirth
Thank you for your help.
The library directory contained some very strangely named
subdirectories, file3132 and similarly.
After removing these and vereything related to SciViews
I was able to install SciViews.
Looking back I seem to remember that form time to time
these strange directories appear and I do not understand
where they come from.
Could it be a timing issue, i.e. Windows trying to remove
a directory too early? I remember similar problems with
temporary files not being deletable by Excel.



Prof Brian Ripley wrote:
> On Sat, 7 May 2005, Erich Neuwirth wrote:
>> bundle 'SciViews' successfully unpacked and MD5 sums checked
>> Error in sprintf(gettext("unable to move temp installation '%d' to
>> '%s'"),  :
>>use format %s for character objects
>>
>> how can I solve this problem?
> 
> 
> Well, use R-patched where that exact problem goes away, but that is not
> the problem that needs solving.
> 
> The underlying cause is a problem on your Windows file system.  Do you
> have a version of SciViews left over that Windows cannot remove?
> 
> I've just tested this, and it works for me even in 2.1.0.
> 

-- 
Erich Neuwirth, University of Vienna
Faculty of Computer Science
Didactic Center for Computer Science
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-39464 Fax: +43-1-4277-39459

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


[R] ScieViews installer

2005-05-07 Thread Erich Neuwirth
I tried to install SciViews in R 2.1.0 (on Windows)
and on all machines I get:

bundle 'SciViews' successfully unpacked and MD5 sums checked
Error in sprintf(gettext("unable to move temp installation '%d' to
'%s'"),  :
use format %s for character objects

how can I solve this problem?



-- 
Erich Neuwirth, University of Vienna
Faculty of Computer Science
Didactic Center for Computer Science
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-39464 Fax: +43-1-4277-39459

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


[R] boxplot in extreme cases

2004-11-07 Thread Erich Neuwirth
I noticed the following:
the 2 datasets
rep(c(0,1,2),c(10,20,40)) and
rep(c(0,1,2),c(10,40,20))
produce identical boxplots despite the fact that the medians are 
different. The reason is that the median in one case coincides with the
first quartile, and in the second case with the third quartile.
Is there a recommended way of displaying the median visibly in these 
cases? Setting notch=TRUE displays the median, but does look strange.

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


Re: [R] one more Rcmdr problem

2004-10-15 Thread Erich Neuwirth
I did experience the same problem.
After installing R 2.0.0 patched and downloading the source for
Rcmdr_0.99-12 from John Fox's Web page
http://socserv.socsci.mcmaster.ca/jfox/Misc/Rcmdr/
and recompiling the package
it now works.
Ctrl-C, Ctrl-X, and Ctrl-V,  in the text boxes of Rcmdr now work.

Adrian Dusa wrote:
Hello,
I'm using R 2.0.0 with the latest Rcmdr package installed from CRAN, on
Windows XP Professional.
When trying to copy some commands or results, either from the upper or lower
text window, this causes Rcmdr to crash:
"R for Windows GUI front-end has encountered a problem and needs to close"
Did anyone have the same problem? I don't think it's my system, as it
happened to reinstall my Windows just a few days ago, and the same problem
occurred in the former one.
Regards,
Adrian

Adrian Dusa
Romanian Social Data Archive
1 Schitu Magureanu Bd.
050025 Bucharest sector 5
Tel. +40 21 3126618\
 +40 21 3153122/ int.101


--
Erich Neuwirth, Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-38624 Fax: +43-1-4277-9386
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] as.complex

2004-10-06 Thread Erich Neuwirth
as.complex("2+1i") -> 2+1i
as.complex("2+i") -> NA
Does somebody have a modified version of as.complex
which does the coercion in a less strict manner and
produces a complex number also for strings like the
second example?
Perhaps it would even make sense to change the behavior
of as.complex to handle the second case.
After all, this is an established way of writing
complex numbers in some programming tools
able to deal with complex numbers.

--
Erich Neuwirth, Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-38624 Fax: +43-1-4277-9386
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] How to do this "combination" ?

2004-09-08 Thread Erich Neuwirth
combinat<-function(els,len){
if (len==1) (return(as.character(els)))
else return(as.vector(t(outer(combinat(els,len-1),as.character(els),
function(x,y)paste(x,y,sep="")
}
combinat(1:2,3)
does what you want

[EMAIL PROTECTED] wrote:
Thanks David first.
Probably, David misunderstood my points.
source vector = (1,2)
the length of the target vector = 3
My expected "complete" outputs should be:
111, 112, 121, 122, 211, 212, 221, 222.
sample(c(1,2),3,replace=TRUE) just gives me one "randomly sampled" 
combination at a time. However, I need the whole list displayed above at a 
time.

Rui
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

--
Erich Neuwirth, Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-38624 Fax: +43-1-4277-9386
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] factor always have type integer

2004-09-08 Thread Erich Neuwirth
The simple answer to my problem (are the values of a vector
numeric or not) is is.numeric, and that is enough for
what I need right now.
But this way I do not get an answer discriminating between
integers and and doubles. What is the canonical way of getting the
type of the values of a vector?
Is there a better way than
valtype<-function(x)
typeof(ifelse(is.factor(x),levels(x),x))

--
Erich Neuwirth, Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-38624 Fax: +43-1-4277-9386
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] factor always have type integer

2004-09-08 Thread Erich Neuwirth
The function I need is
valtype<-function(x)
typeof(ifelse(is.factor(x),levels(x),x))
It is easy enough to write.
Are there any other special cases where the values
and the storage mode differ?
The background for all this is that I am transferring data
from R to Excel with VBA and I have to handle numbers
and strings differently. So I need to check for the type
of values I will get returned before I do the transfer.
Therefore, I would like to know if there are other types of variables
(besides factors) which give a misunderstandable answer about the type 
of their values when asked typeof.


Prof Brian Ripley wrote:
On Wed, 8 Sep 2004, Erich Neuwirth wrote:

typeof applied to a factor always seems to return "integer",
independently of the type of the levels.

typeof is telling you the internal structure. From ?factor
 'factor' returns an object of class '"factor"' which has a set of
 integer codes the length of 'x' with a '"levels"' attribute of
 mode 'character'. 

(Despite that, we don't enforce this and people have managed to create 
factors with non-integer numeric codes.)

Now ?typeof says
 'typeof' determines the (R internal) type or storage mode of any
 object
and that is the "integer" as the codes are stored in an INTSXP.
BTW, factors were an internal type long ago, and were one of the two
unnamed types which appear in output from memory.profile().

This has a strange side effect.

It's a very well documented feature of data.frame, as others have 
pointed out.


When a variable is "imported" into a data frame,
its type changes.
character variables automatically are converted
to factors when imported into data frames.
Here is an example:
> v1<-1:3
> v2<-c("a","b","c")
> df<-data.frame(v1,v2)
> typeof(v2)
[1] "character"
> typeof(df$v2)
[1] "integer"
It is somewhat surprising that
the types of v2 and df$v2 are different.
the answer is to do
levels(df$v2)[df$v2]
but that is somewhat involved.
Should the types not be identical, and typeof applied to factors
return the type of the levels?



--
Erich Neuwirth, Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-38624 Fax: +43-1-4277-9386
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] factor always have type integer

2004-09-08 Thread Erich Neuwirth
typeof applied to a factor always seems to return "integer",
independently of the type of the levels.
This has a strange side effect.
When a variable is "imported" into a data frame,
its type changes.
character variables automatically are converted
to factors when imported into data frames.
Here is an example:
> v1<-1:3
> v2<-c("a","b","c")
> df<-data.frame(v1,v2)
> typeof(v2)
[1] "character"
> typeof(df$v2)
[1] "integer"
It is somewhat surprising that
the types of v2 and df$v2 are different.
the answer is to do
levels(df$v2)[df$v2]
but that is somewhat involved.
Should the types not be identical, and typeof applied to factors
return the type of the levels?
--
Erich Neuwirth, Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-38624 Fax: +43-1-4277-9386
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Permutations

2004-07-14 Thread Erich Neuwirth
Perhaps what you want might better be described as
ordered partitions?
Is what you want the following:
We study sequences of length 12 and divide them in
4 segments
position 1 2 3, position 4 5 6,
position 7 8 9, position 10 11 12,
Find all permutation sequences of the numbers 1 to 12
with the property that all segment sequences
are monotonically increasing.
I think that produces what you need.
Since the segments are ordered, you avoid intra-block permutations.
If that is what you want, writing a recursive function should not be
too hard.

Jordi Altirriba Gutiérrez wrote:
Dear R users,
I’m a beginner user of R and I’ve a problem with permutations that I 
don’t know how to solve. I’ve 12 elements in blocks of 3 elements and I 
want only to make permutations inter-blocks (no intra-blocks) (sorry if 
the terminology is not accurate), something similar to:

1 2 3 | 4 5 6 | 7 8 9 | 10 11 12   --1st permutation
1 3 2 | 4 5 6 | 7 8 9 | 10 11 12   NO
  -  -
3 2 1 | 4 5 6 | 7 8 9 | 10 11 12   NO
-  -  -
1 2 4 | 3 5 6 | 7 8 9 | 10 11 12   YES-2nd permutation
 --
4 5 6 | 1 2 3 | 7 8 9 | 10 11 12   YES-3rd permutation
-  -  -   -  -  -
4 5 6 | 2 1 3 | 7 8 9 | 10 11 12   NO
  -  -

 Thanks for your time,
Jordi Altirriba
Ph D student
Hospital Clinic – Barcelona - Spain
MSN Motor. http://motor.msn.es/researchcentre/
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html


--
Erich Neuwirth, Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-38624 Fax: +43-1-4277-9386
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] RGui Titlebar

2004-07-14 Thread Erich Neuwirth
In the windows version (RGui), is there a way to set
the text displayed in the titlebar of the R window?
When I have 2 instances of RGui running, it would be helpul
if the titlebar could help to understand which is which.
--
Erich Neuwirth, Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-38624 Fax: +43-1-4277-9386
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] [R-pkgs] R (D)COM server, new release

2004-06-22 Thread Erich Neuwirth
Today we uploaded a new release of the
R (D)COM server for Windows to CRAN.
It is release 1.35
The software is much more stable, and there are
quite a few improvements.
Excerpts from the NEWS file:
RServerManager has been added. This provides a repository for R COM 
servers.  See the samples and the additional documentation

Partial rewrite of the code for SetSymbol() and GetSymbol().
Now arrays of VARIANTs are supported to some degree.
This makes the COM server accessible to many scripting languages
Sample usage for JScript, Python, and VBScript added
New tools library provided for Excel to remotely access COM server
without the need for local installation
The software should appear on CRAN in the "Other" section
within the next few days.
Thomas Baier
Erich Neuwirth

--
Erich Neuwirth, Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-38624 Fax: +43-1-4277-9386
___
R-packages mailing list
[EMAIL PROTECTED]
https://www.stat.math.ethz.ch/mailman/listinfo/r-packages
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] R help in Firefox on Windows XP

2004-06-18 Thread Erich Neuwirth
Thank you Brian,
Installing 0.8 first and then upgrading solved the problem.
I noticed that installing 0.9 from scratch creates a registry key
[HKEY_LOCAL_MACHINE\SOFTWARE\mozilla.org\Mozilla]
"CurrentVersion"="1.7"
Installing 0.8 creates
[HKEY_LOCAL_MACHINE\SOFTWARE\mozilla.org\Mozilla]
"CurrentVersion"="1.6"
and upgrading to 0.9 afterwards does not change this entry.
This might be the reason.

Prof Brian Ripley wrote:
Works for me.  Did it work with Firefox 0.8?  (I upgraded from 0.8.)
I would try 0.8 and then upgrade.
On Thu, 17 Jun 2004, Erich Neuwirth wrote:
 

I had to reinstall my machine, so I installed Firefox 0.9 as browser
I am using WinXP and R 1.9.1 beta.
Now search in R html help does not work.
I checked that the Java VM is working correctlt, Sun's test site says
my installation is OK.
Firefoxalso tells me that
Applet Searchengine loaded
Applet Searchengine started
it just does not find anything.
Does anybody know how to solve this?
  

 


Prof Brian Ripley wrote:
Works for me.  Did it work with Firefox 0.8?  (I upgraded from 0.8.)
I would try 0.8 and then upgrade.
On Thu, 17 Jun 2004, Erich Neuwirth wrote:
 

I had to reinstall my machine, so I installed Firefox 0.9 as browser
I am using WinXP and R 1.9.1 beta.
Now search in R html help does not work.
I checked that the Java VM is working correctlt, Sun's test site says
my installation is OK.
Firefoxalso tells me that
Applet Searchengine loaded
Applet Searchengine started
it just does not find anything.
Does anybody know how to solve this?
   

 

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] R help in Firefox on Windows XP

2004-06-17 Thread Erich Neuwirth
I had to reinstall my machine, so I installed Firefox 0.9 as browser
I am using WinXP and R 1.9.1 beta.
Now search in R html help does not work.
I checked that the Java VM is working correctlt, Sun's test site says
my installation is OK.
Firefoxalso tells me that
Applet Searchengine loaded
Applet Searchengine started
it just does not find anything.
Does anybody know how to solve this?
Erich
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Hankel Matrix

2004-04-30 Thread Erich Neuwirth
hankel<-function(seq){
outer(1:((length(seq)+1)/2),1:((length(seq)+1)/2),
function(x,y) seq[x+y-1])
}
will take a sequence of odd length and ouput the corresponding
square Hankel matrix.
Fred J. wrote:
> Hello
> is there a function in R to generate Hankel Matrix?

--
Erich Neuwirth, Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-38624 Fax: +43-1-4277-9386
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] New unique name

2004-04-19 Thread Erich Neuwirth
Since I have not been precise enough, let me explain in more detail.
I am executing some R code in the COM server.
For making function calls with parameters existing as ranges in Excel,
I need to assign values for the arguments of the function call to
temporary R variables.
This is the only way of transferring large matrices quickly from Excel
to R.
Then, I construct a string which is the function call to be executed.
The string contains the names of the newly created R variables
for the function arguments.
This string then is sent to R and executed as a command.
Therefore, I need names which do not get in conflict with anything
defined at the moment, because these names have to hold my transferred
matrices and should not change anything that exists at that moment.
I do some funny stuff with a strange word and the date and the clock
at the moment, but I would like a cleaner solution.
What is an easy way of doing this?

All the Linux based solutions will not work, since this for the
RExcel project.
Erich Neuwirth

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] New unique name

2004-04-19 Thread Erich Neuwirth
In some languages there is a function
gensym()
which returns a new unique name (in the current environment).
This is quite helpful when one has to do temporary assignments.
I could not find such a function in R.
Is there one?
--
Erich Neuwirth, Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-38624 Fax: +43-1-4277-9386
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Solving Matrices

2004-04-15 Thread Erich Neuwirth


On April 15th, Elizabeth wrote:

(or x <- matrix(data=c(7, -5, 6, -7, 2, -3, 10, 9, -5,
  4, -2, 2, 8, -9, 7, 15), nrow=4, ncol=4)


qr(x)$rank
gives the rank
qr.R(qr(x))
gives the R part (an upper triangular matrix similar to the one
produced by Gauss elimination).
With the given matrix, we get rank 3, but the
last row of qr.R(qr(x)) is not 0 due to rounding errors.
--
Erich Neuwirth, Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-38624 Fax: +43-1-4277-9386
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Execute function at startup

2004-04-13 Thread Erich Neuwirth
It would be convenient to have something like
Rgui runfist="myfunction()"
in Windows.
The reason:
AFAIK Rgui does not accept piped input
(RGui < myfile.R does not seem to work).
A solution could be to put a few fuctions in Rprofile and then
give the name for one of these functions to be executed at startup as
a command line parameter to Rgui.
Can something like this be done?

--
Erich Neuwirth, Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-38624 Fax: +43-1-4277-9386
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Windows startup question

2004-04-12 Thread Erich Neuwirth
I would like to be able to double click on an R source file
and by that start R and have the file sourced in R.
I am using WinXP Pro.
So I created an association for file type R and tye following
Run action:
"C:\Program Files\R\rw1090beta\bin\Rgui.exe" R_PROFILE=%1
I have an R file with the following lines at the beginning.

library(vcd)
votes<-array(0,10*7*9*2)
dim(votes)<-c(10,7,9,2)
Double clicking this file (in Windows Explorer) starts R and then 
produces the following output.

Attaching package 'vcd':

The following object(s) are masked from package:base :

 print.summary.table summary.table

Error in dim(votes) <- c(10, 7, 9, 2) : cannot do complex assignments in 
base namespace

So it seems the first 2 lines are executed,
the vector votes exists, but cannot be redimensioned as an array.
Can i make what I would like fully functional?

--
Erich Neuwirth, Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-38624 Fax: +43-1-4277-9386
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] italian keyboard and ~ symbol

2004-03-30 Thread Erich Neuwirth
Before using the sequence
 + Num1 + Num2 + Num6 + 
one has to make sure that the numeric keyboard is in NumLock mode,
not in cursor mode.
If it is in cursor mode, this trick will not work
(at least it does not on my machine)


Federico Calboli wrote:

On Tue, 2004-03-30 at 11:48, Henrik Bengtsson wrote:

 + Num1 + Num2 + Num6 +  where Num1, Num2 &
Num6 are 1, 2 & 6 on the *numeric keyboard* (not the ones above the
letter keys) will produce ASCII character 126 ("~", tilde) on my WinXP
Pro in both Rterm and Rgui for R v1.8.1. Do you get anything at all?
Does it work in any other Windows applications or dialogs (you
mentioned Word)? What about  + Num6 + Num5 + 
(should give "A")?


Rather annoyingly it does not work.

You could also consider remapping your keyboard, i.e. for some
physical key replace a "useless/never used" character with "~"
(tilde). Some initial links can be found at
http://www.maths.lth.se/help/windows/keyboard/.


It appears it is the only option.

Regards,

Federico
--
Erich Neuwirth, Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-38624 Fax: +43-1-4277-9386
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Build problems on Windows with fpTeX and MiKTeX

2004-03-28 Thread Erich Neuwirth
Things work again.

I did a clean build for r-devel, getting a fresh source tree,
and now things work again (with fpTeX).
I also build abind and adapt to check if
packages can be build from source on Windows.
Both worked.
I did these two packages because abind is an "R code only" package and
adapt includes C and Fortran code.
--
Erich Neuwirth, Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-38624 Fax: +43-1-4277-9386
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Build problems on Windows with fpTeX and MiKTeX

2004-03-28 Thread Erich Neuwirth
Recently,
I upgraded MiKTeX to the latest versions, and since then there are 
problems when I try to build R and/or R packages.
I tried to build R 1.9.0 beta and R 1.8.1 patched

I am running Windows XP Pro, SP 1
MikTeX version is
This is e-TeX, Version 3.141592-2.1 (MiKTeX 2.4)
(preloaded format=latex 2004.3.27)
fpTeX version is
This is e-TeXk, Version 3.141592-2.1 (Web2c 7.5.2)
(format=latex 2004.3.23)  27 MAR 2004 21:58
With MiKTeX, it is not possible any more
do build documentation  either for R itself or for packages,
I get the following error
! LaTeX Error: Command \middle already defined.
   Or name \end... illegal, see p.192 of the manual.
See the LaTeX manual or LaTeX Companion for explanation.
Type  H   for immediate help.
 ...
l.45 \newlength{\middle}

With fpTeX, I can build R itself, but when I try to build packages,
I get
(c:/Program Files/TeXLive/texmf/tex/latex/graphics/color.sty
Package: color 1999/02/16 v1.0i Standard LaTeX Color (DPC)
(c:/Program Files/TeXLive/texmf/tex/latex/texlive/color.cfg
File: color.cfg 2001/08/31 v1.1 color configuration of teTeX/TeXLive
)
! Package color Error: No driver specified.

See the color package documentation for explanation.
Type  H   for immediate help.
 ...
l.123  }

You should make a default driver option in a file
color.cfg
eg: \ExecuteOptions{dvips}
)

Both versions of TeX are installed the standard way,
without changes (except adding a few local LaTeX style files).
Is this happening to anybody else?



--
Erich Neuwirth, Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-38624 Fax: +43-1-4277-9386
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] R: Including R plots in a Microsoft Word document

2004-02-24 Thread Erich Neuwirth
Saving as a metafile should to the trick.
emf files work nicely in Word.
Michael A. Miller wrote:

"Frank" == Frank E Harrell <[EMAIL PROTECTED]> writes:


> Also, has anyone tried creating a Word document using
> OpenOffice with figures imported from R?
I've tried that.  It works fine with openoffice, but not with
word.  For example, create a postscript file with R like this:
--
Erich Neuwirth, Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-38624 Fax: +43-1-4277-9386
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] ID mprxahov... thanks

2004-02-17 Thread erich . neuwirth
Yours ID hkpw
--
Thank 

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Re: [R] Questions about Matrix

2004-02-16 Thread Erich Neuwirth
whatisit<-function(t,m,n) outer(0:t,1:m,function(x,y)(x-y)^n)

> whatisit(3,2,4)
 [,1] [,2]
[1,]1   16
[2,]01
[3,]10
[4,]   161


Yao, Minghua wrote:

M <- matrix(0, t+1, m)
for (i in 1:(t+1))
  for(j in 1:m)
M[i,j] <- (i-1-j)^n


From: [EMAIL PROTECTED] on behalf of duoduo chen
Sent: Mon 2/16/2004 2:41 PM
To: [EMAIL PROTECTED]
Subject: [R] Questions about Matrix


How to Generate the Matrix (t+1)*m ?

(0-1)^n   (0-2)^n  (0-m)^n
(1-1)^n   (1-2)^n  (1-m)^n
(2-1)^n   (2-2)^n  (2-m)^n
   ..   ...  ...
(t-1)^n(t-2)^n   (t-m)^n 

Appreciate your kindly help!



-

[[alternative HTML version deleted]]

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


	[[alternative HTML version deleted]]

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
--
Erich Neuwirth, Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-38624 Fax: +43-1-4277-9386
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] D(COM) with Excel

2004-01-26 Thread Erich Neuwirth
Hi,

as the one who wrote the RExcel package let me add something to the 
discussion.

Thomas Baier's R (D)COM package tries to use "native" Windows
data types to be as fast as possible.
My RExcel package has the following philosophy:
Offer R functions to people who "think spreadsheet".
One way of describing it is:
You can have an R process living in each cell of the spreadsheet,
and the output of R we want to deal with hast to be compatible with the
spreadsheet structure. That is the reason for the restriction to
arrays.
Spreadsheets (NOT the embedded programming language)
do not know about objects.
Somewhat oversimplifying one might say:
RExcel brings R computation to the spreadsheet,
and RDCOM brings R objects to VBA.
Erich Neuwirth





David James wrote:

Hi Joel,

You may want to take a look at the RDCOM implementation at
http://www.omegahat.org/RDCOMServer.  We've had very good
experience with it.
--
David
Joel Pitt wrote:
 

Hi there,

I'm currently trying to use R in an automated
macro with Excel, and to this effect I've been
using the D(COM) server.
However I've been having alot of problems with
it, because it seems to be limited to only recieving
and sending arrays. I've been struggling
trying to find a way to receive model summaries
from R to put in Excel. I also seem to have
some strange errors coming up...
I've tried doing everything I want directly in R
by hand, and it has been fine, but excel seems to
complicate everything :(
Any people have suggestions?

Thanks,
joel
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
   

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 



--
Erich Neuwirth, Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-38624 Fax: +43-1-4277-9386
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] fedora and yum

2004-01-15 Thread Erich Neuwirth
I just installed Fedora in VMWare.
Can somebopdy tell me what lines i have to put in
yum.conf
so R will be automatically integrated in the package system
and updated when a new release is available?
--
Erich Neuwirth, Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-38624 Fax: +43-1-4277-9386
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] R video

2003-09-09 Thread Erich Neuwirth
Quicktime also can convert sequences of images into
quicktime and avi movies.
It accepts quite a lot of different image formats.




Thomas Petzoldt wrote:

David Khabie-Zeitoune schrieb:

Hi

Does anybody know of any R packages under Windows to produce video files
from a sequence of R graphs -- e.g. in .wmv or avi format?

Erich Neuwirth

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] R as COM client (rather than server)

2003-06-30 Thread Erich Neuwirth
It can be done.
But it is still in development and therefore not on CRAN.
There is a library rcom which does exactly what you are asking for.
http://sunsite.univie.ac.at/rcom/

always has the latest version of the R COM package,
currently including the package for R as a client also.
There is a special mailing list for questions
related to R and (D)COM
you can subscribe to it at
http://mailman.csd.univie.ac.at/mailman/listinfo/rcom-l



DED (David George Edwards) wrote:
Hello all

Can R be used as a COM client (rather than as a COM server)? The following
(Splus) code shows the sort of thing I'd like to do:
	pMIM <- create.ole.object("mim31.Server")
	NoOutputLines <- call.ole.method(pMIM, "SendCmdLine", "show w") 
	for (i in 1:NoOutputLines) show(call.ole.method(pMIM,
"GetOutputLine"))
	release.ole.object(pMIM)
I've tried to look at the RDCOM documentation but could not figure out
whether this can be done.
Regards
David

David Edwards, Biostatistics, 
Novo Nordisk A/S, Bagsværd, Denmark.
[EMAIL PROTECTED]  
Tlf: +45 44 42 62 35. Fax: +45 44 42 14 80

	[[alternative HTML version deleted]]

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] excel files and R

2003-06-25 Thread Erich Neuwirth
And there is Thomas Baier's and my RCOM package
which would allow to run R from within Excel
or exchange data between Excel and R with R
as the main interface.
Morrison, Gordon wrote:
If you really want to run windows from R (in my experience it is much better
to reside entirely within R) then I think that you need to use Duncan Temple
Lang's RDCOM package ( http://www.omegahat.org/ ). It works well and
robustly for connections to other packages and I have tested it for Excel.
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] rsync

2003-03-21 Thread Erich Neuwirth


Seth Falcon wrote:

I am now downloading r-devel to compile it on windows XP. The CRAN
source code page says "you will prefere to use rsync". I am googling 
around, and cannot find anything about rsync on windows. 
   

You can use rsync on Windows via the Cygwin toolset (see
www.cygwin.com).  
 

If you do that and also want to use Brian Ripley's toolkit for compiling,
you might get into trouble because of incompatible versions of
cygwin1.dll
I managed to get a working solution by using rsync from

http://optics.ph.unimelb.edu.au/help/rsync/rsync_pc1.html

and putting rsync.exe into the directory with brian's binaries (sed, 
grep, diff ...)
this rsync vversion can work with brian's version of cygwin1.dll.

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R]

2003-03-18 Thread Erich Neuwirth
Searching for
Arithmetic
shows
%%
as an infix operator


Oezlem Gengaslan wrote:

Hi,

can someone tell me, if there is a function in R for the modulo operator?

bye

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Access to R from a remote location

2003-01-10 Thread Erich Neuwirth
instead of realvnc you might also consider
eSVNC, available from
http://perso.wanadoo.fr/samfd/esvnc

it has one additional feature:
file transfer.

so if you need to transfer data to r from your local machine,
it might be the better solution.

Jonathan Baron wrote:


On 01/09/03 13:12, Erick Edwards wrote:
 

Currently, our organization grants some employees remote access to SAS
and other software through a secure Citrix-based network server.  We
would like to install R on a dedicated network server and enable remote
access through Citrix.  Is this possible?  If so, what additional
software would we need?  Any advice would be greatly appreciated.
   


I don't know about Citrix, but I have had success running R with
VNC (http://realvnc.com).  Of course, since R is free, everyone
who uses it can install it.  But for occasional users, like
students doing an assignment, this works well.  Jon

 


__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help



Re: [R] Access to R from a remote location - follow up

2003-01-10 Thread Erich Neuwirth
for keeping a job running when i log out on a unix system
i use the gnu tool
screen

it has many functions,
one being able to disconnect from a running (even interactive)
terminal session and making the process believe that you are still
connected. next time you log in, you connect to the "old" session.

so it definitely would support what you want to do.




Roger Peng wrote:


This is possible because I've done it many times.  But I think whether or
not your job gets killed when you log out depends on your shell/operating
system.

-roger
___
UCLA Department of Statistics
[EMAIL PROTECTED]
http://www.stat.ucla.edu/~rpeng

On Thu, 9 Jan 2003, Martin Renner wrote:

 

Following up on Erick's post, does anybody know whether it is 
possible to start a lengthy batch-job in R, then log-out/break a 
dial-up connection (while R is still running) and later pick-up the R 
outfile?
   


__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help