Re: [R] ggplot2: geom_segment does not produce the color I desire?

2016-09-17 Thread Erich Neuwirth
Here are 2 solutions to you problem: If you only want to use one color (for possibly many arrows), this will work: ggplot()+geom_segment(mapping = aes(x = as.Date(test[,"date"]), y =y1, xend = as.Date(test[,"date"]),

[R] gene name problem in Excel, and an R analogue

2016-09-14 Thread Erich Neuwirth
Since many people commenting on the gene name problem in Excel essentially tell us This could never have happened with R I want to show you a somewhat related issue: ff1 <- tempfile() cat(file = ff1, "12345", "1E002", sep = "\n") xdf1 <- read.fwf(ff1, widths = 5, stringsAsFactors=FALSE) ff2 <-

Re: [R] workflow getting UTF-8 csv in and out of R on Mac (spreadsheet editor)

2016-09-02 Thread Erich Neuwirth
read_excel in Hadley’s readxl package should handle your encoding problems. Writing Excel files on a Mac, however, still is somewhat messy. And you probably should post this kind of question on r-sig-mac On 02 Sep 2016, at 13:03, Kai Mx wrote: > > Hi all, > > I am hoping

[R] Install on Xenial

2016-05-04 Thread Erich Neuwirth
I am trying to install R-3.3.0 on Xenial. I followed the instructions on the corresponding CRAN page, and I added the GPG key. But after adding deb https://cran.at.r-project.org//bin/linux/ubuntu xenial/ to /etc/apt/sources.list and sudo apt-get update I get the following error: Err:7

Re: [R] Compute the Gini coefficient

2016-03-30 Thread Erich Neuwirth
> On 30 Mar 2016, at 02:53, Marine Regis wrote: > > Hello, > > I would like to build a Lorenz curve and calculate a Gini coefficient in > order to find how much parasites does the top 20% most infected hosts support. > > Here is my data set: > > Number of parasites

Re: [R] Persistent state in a function?

2016-03-19 Thread Erich Neuwirth
package memoise might help you > On 19 Mar 2016, at 17:45, Boris Steipe wrote: > > Dear all - > > I need to have a function maintain a persistent lookup table of results for > an expensive calculation, a named vector or hash. I know that I can just keep > the table

Re: [R] FUNCTION ctree

2016-03-10 Thread Erich Neuwirth
If you do ??ctree and the package partykit is installed, you will see that this function is defined in this package. So, you should run library(partykit) before running your function call If partykit is not installed, you need to install it. > On Mar 10, 2016, at 15:58, CHIRIBOGA Xavier

Re: [R] .Call works in R 2 not in R 3

2016-03-08 Thread Erich Neuwirth
cutree is a function available in stats. So it might be worth a try to just replace .Call("R_cutree", tree$merge, k, PACKAGE = "stats”) by cutree(tree$merge,k) and see what happens. checking the source of cutree shows the following call ans <- .Call(C_cutree, tree$merge, k) so replacing

Re: [R] readRDS problem

2016-02-24 Thread Erich Neuwirth
?data will show you that data is a reserved word! > On 24 Feb 2016, at 11:02, Sigbert Klinke wrote: > > Hi, > > thanks, using > > test <<- readRDS (name) > > it worked. But why? > > Best Sigbert > > Am 24.02.2016 um 10:39 schrieb Michael Dewey: >> Try calling it

Re: [R] choropleth packages (US)

2015-12-07 Thread Erich Neuwirth
ggplot2 also can do this with fortify geom_polygon Von meinem iPad gesendet > Am 06.12.2015 um 21:03 schrieb Benjamin Tyner : > > Hi > > I wish to draw a basic choropleth (US, by state) and am wondering if anyone > has any recommendations? I've tried the following thus far:

Re: [R] Can we use all the functions of R in visual studio? The Rmath.dll and R.dll seems only contain a part of R functions

2015-12-04 Thread Erich Neuwirth
There is statconnDCOM, whoch gives full R as a COM server which can be used from all he Visual languages. It is not free. There are cost free licenses for student and home use, but essentially it is a commercial product. Mor information can be found at www.statconn.com

Re: [R] is.na behavior

2015-11-19 Thread Erich Neuwirth
I am not sure I undestand the issue. But if the question is to decidedif an expression evaluates to NA, using eval should solve the problem. In fact, I do not really understand what an NA expression, and not an expression evaluating to NA, means. signature.asc Description: Message signed with

Re: [R] Creating new variables in R

2015-10-26 Thread Erich Neuwirth
data <- within(data,variable3=pmax(variable1,variable2)) also should work if your variables are numeric. using dplyr and magrittr (which I recommend to all my students) it could be library(dplyr) library(magrittr) data %<>% mutate(variable3=pmax(variable1,variable2)) > On 26 Oct 2015, at

Re: [R] ggplot: combining geom's in function

2015-10-23 Thread Erich Neuwirth
I often look for examples in http://www.cookbook-r.com/Graphs/ > On 23 Oct 2015, at 18:27, Jeff Newmiller wrote: > > Have you looked at the qplot function in the ggplot2 package? >

Re: [R] Spreadsheet math problem (exponentiation)

2015-09-18 Thread Erich Neuwirth
Let me add a little bit here: When using math formulas, one should know about the parsing rules form complex expression which do not have all the necessary parenthesis. Different systems do have different parings rules. In the case of a^b^c, the expression is ambiguus because (as mentioned in a

Re: [R] Spreadsheet math problem (exponentiation)

2015-09-18 Thread Erich Neuwirth
Methinks that any math teaching should make learners aware of the fact that math conventions are not laws of nature, and that ambiguous expressions may produce different values in different systems. I think -2^2=4 is perfectly reasonable. In my experience, most people after high school math do

Re: [R] data format

2015-08-19 Thread Erich Neuwirth
This is the kind of problem the package tidyR has been designed for. On 19 Aug 2015, at 16:29, minikg min...@cmfri.org.in wrote: Hi, I have a dataset consisting of landmarks of each sample's coordinates as given below. landmark X Y X Y X Y P1

Re: [R] about R 3.2.0

2015-07-25 Thread Erich Neuwirth
If you are running R on Windows, there is the package installr which will help you with the process of upgrading. And item 2.8 in the R for Windows FAQ has some information about upgrading also. On 25 Jul 2015, at 06:41, Waqas Shafqat waqas1...@gmail.com wrote: Dear sir, I am using

Re: [R] interactive Map: Popups

2015-07-23 Thread Erich Neuwirth
and its examples. It is awesome! Thanks, Erin On Thu, Jul 23, 2015 at 6:28 AM, Erich Neuwirth erich.neuwi...@univie.ac.at mailto:erich.neuwi...@univie.ac.at wrote: I am quite happy with that package leaflet which is not yet on CRAN but available on Githib. https://github.com/rstudio

Re: [R] interactive Map: Popups

2015-07-23 Thread Erich Neuwirth
I am quite happy with that package leaflet which is not yet on CRAN but available on Githib. https://github.com/rstudio/leaflet https://github.com/rstudio/leaflet signature.asc Description: Message signed with OpenPGP using GPGMail __

Re: [R] tcltk problem

2015-03-12 Thread Erich Neuwirth
Thesw are demos for tclscrollbar I copied them from the help file to the console manually as the help file suggested. On 12 Mar 2015, at 09:04, peter dalgaard pda...@gmail.com wrote: On 11 Mar 2015, at 23:41 , Erich Neuwirth erich.neuwi...@univie.ac.at mailto:erich.neuwi...@univie.ac.at

Re: [R] tcltk problem

2015-03-12 Thread Erich Neuwirth
. On 12 Mar 2015, at 09:04, peter dalgaard pda...@gmail.com wrote: On 11 Mar 2015, at 23:41 , Erich Neuwirth erich.neuwi...@univie.ac.at mailto:erich.neuwi...@univie.ac.at wrote: OSX 10.10.2 R 3.1.3 XQuartz installed. I am trying to run one of the tcltk demos Which demos? Doesn't look

[R] tcltk problem

2015-03-11 Thread Erich Neuwirth
OSX 10.10.2 R 3.1.3 XQuartz installed. I am trying to run one of the tcltk demos This one works: tt - tktoplevel() label.widget - tklabel(tt, text = Hello, World!) button.widget - tkbutton(tt, text = Push, command = function()cat(OW!\n)) tkpack(label.widget,

Re: [R] %%

2015-02-17 Thread Erich Neuwirth
AFAIK dplyr imports magrtittr. So dplyr ses %% from migrittr, it does not have its own version. On Feb 17, 2015, at 22:19, Ben Bolker bbol...@gmail.com wrote: David Barron dnbarron at gmail.com writes: It's in the magrittr package. David It also exists in dplyr. (I would

Re: [R] transpose a data frame according to a specific variable

2015-02-09 Thread Erich Neuwirth
library(tidyr) spread(DF,Year,Day) On 09 Feb 2015, at 16:47, jeff6868 geoffrey_kl...@etu.u-bourgogne.fr wrote: finalDF - data.frame(id=c(A,B,C),2000=c(NA,NA,164),2001=c(120,NA,99), 2002=c(90,18,48),2003=c(54,217,NA),2004=c(NA,68,NA)) signature.asc Description: Message signed with

Re: [R] Generate random numbers under constrain

2014-11-27 Thread Erich Neuwirth
You want random numbers within the n-dimensional simplex (sum xi =1) The easiest solution of course would be creating n-dimensions vectors with iid uniform components on [0,1) and throwing away those violating the inequality. Since the volume of the n-dimensional simplex is 1/n! (factorial) this

[R] Slight misinformation in OSX version of R

2013-09-25 Thread Erich Neuwirth
I just installed R on a Mac without any traces of earlier versions. It exhibited a well know problem: WARNING: You're using a non-UTF8 locale, therefore only ASCII characters will work. Please read R for Mac OS X FAQ (see Help) section 9 and adjust your system preferences accordingly. The

Re: [R] transform variables

2013-08-26 Thread Erich Neuwirth
Have a look at the packages reshape and reshape2 They were written with this type of problems in mind. On Aug 26, 2013, at 1:04 PM, catalin roibu catalinro...@gmail.com wrote: Dear all! I have a data frame composed by 13 columns (year, and 12 months). I want to transform this data base in

Re: [R] Rexcel

2013-08-22 Thread Erich Neuwirth
Free support for RExcel is available by subscribing to the mailing list at rcom.univie.ac.at and posting questions to the list. On Aug 22, 2013, at 7:04 PM, Jeff Newmiller jdnew...@dcn.davis.ca.us wrote: This is not on topic for this mailing list. See the Statconn website for support for

Re: [R] problems with constrained optimization

2013-08-19 Thread Erich Neuwirth
Bad starting value. Try c(3/5,4/5) On Aug 19, 2013, at 1:33 PM, il...@gertner.health.gov.il wrote: I tried ti run a simple example with function solnp() from Rsolnp: find max(x+y) on a unit circle x*x+y*y=1. The answer should be x=y=1/sqrt(2) with max=sqrt(2). Here are my code and results

Re: [R] RScript.exe and map directory issue

2012-06-01 Thread Erich Neuwirth
To put double quotes in a string in VBA one has to use double double quotes str = a string with a quoted word On Jun 1, 2012, at 12:26 AM, Duncan Murdoch wrote: On 12-05-31 4:40 PM, Bert Jacobs wrote: Hi, I'm trying to run on Windows 7 a scriptfile with Rscript.exe from within Excel 2010

Re: [R] Interactive Plot in R?

2012-05-19 Thread Erich Neuwirth
You might want to give the packages animation a try. On May 19, 2012, at 11:47 AM, c...@mail.tu-berlin.de wrote: Hi, I want to do an interactive plot in R: I have a time series and I can plot it in the normal way: plot(modifieddate,timeseries,type=l,xlab=Date,ylab=values, main=title)

Re: [R] R report generator (for Word)?

2012-01-02 Thread Erich Neuwirth
A little bit more information about SWord: It is similar to SWeave in the sense that one writes text and R code in one document, and the toolchain then replaces the R code by the results produced by running the R code. In SWeave, this produces a new file which then can processed by TeX. In

Re: [R] Problem with RCOM package

2011-12-23 Thread Erich Neuwirth
All questions related to rcom, statconnDCOM, and RExcel should be posted on the mailing list of the statconnDCOM project. You can subscribe at http://rcom.univie.ac.at On 12/23/2011 11:02 AM, KUMAR wrote: Hi, I am using R version 2.14.0 on windows 7. Trying to use RCOM

Re: [R] List of user installed packages

2011-11-05 Thread Erich Neuwirth
Running rownames(installed.packages()) will tell you the names of all packages of the version of R in which you are running the command. http://cran.r-project.org/doc/FAQ/R-FAQ.html#R-Add_002dOn-Packages tells you the names of the packages which were installed with R itself. On Nov 5, 2011,

[R] Size of windows graphics device

2011-11-02 Thread Erich Neuwirth
R for Windows 2.14.0 Is there a function reporting the size of the current windows device after it has been resized manually? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] extracting p-values in scientific notation

2011-10-03 Thread Erich Neuwirth
format.pval is documented and accessible from outside of base. So you do not have to qualify it as base::format.pval On 10/3/2011 11:24 AM, Liviu Andronic wrote: Thanks all for your pointers. The following does trick: base::format.pval(x$p.value) ##Hmisc also has such a function [1] 2e-16

Re: [R] Namespace in packages

2011-09-01 Thread Erich Neuwirth
On 9/1/2011 1:04 PM, Eran Eidinger wrote: Hello, I wonder how I might create a package that only reveals some of the function in the package to the user. I've tried creating an R package using the following: f- function(x,y) x+y g- function(x,y) x-y h- function(x,y) f(x,y)*g(x,y)

Re: [R] Build a package - check error

2011-08-21 Thread Erich Neuwirth
On 8/20/2011 3:37 PM, Uwe Ligges wrote: ?.First.lib has an example: ## Suppose a package needs to call a DLL named 'fooEXT', ## where 'EXT' is the system-specific extension. Then you should use .First.lib - function(lib, pkg) library.dynam(foo, pkg, lib) Shouldn't the first line here

Re: [R] Elegant way to subtract matrix from array

2011-07-27 Thread Erich Neuwirth
A-kronecker(rep(1,10),S) kronecker(m1,m2) creates a tiled matrix each element of m1 in replaced by m2 multiplied with the element of m1 m1 = (1 2) (3 4) m2 = (11 12) (13 14) kronecker(m1,m2) therefore is 1 * (11 12)2 * (11 12) (13 14)(13 14) 3 * (11 12)

Re: [R] [RExcel] please help me to set up RExcel via a remote server

2011-06-20 Thread Erich Neuwirth
statconnDCOM and RExcel have their own mailing list. Please subscribe at rcom.univie.ac.at and post you question there. On Jun 17, 2011, at 7:55 AM, Takatsugu Kobayashi wrote: Hi RUsers, I am currently tying to use RExcel via R installed in my remote server (CentOS 5.5). Could you please

Re: [R] computer name

2011-06-13 Thread Erich Neuwirth
This depends on your OS. on Windows, Sys.getenv('computername') should work. Sys.info()['nodename'] should work on all systems. On 6/13/2011 7:38 AM, David Scott wrote: On 13/06/11 15:19, pdb wrote: Is there an r function that will be able to identify the computer the code is running on?

Re: [R] summing array elements

2011-05-26 Thread Erich Neuwirth
arr-1:72 dim(arr)-c(2,4,3,3) apply(arr,1:2,sum) [,1] [,2] [,3] [,4] [1,] 297 315 333 351 [2,] 306 324 342 360 apply(arr,3:4,sum) [,1] [,2] [,3] [1,] 36 228 420 [2,] 100 292 484 [3,] 164 356 548 apply(arr,1:2,sum) will sum all elements arr(i1,i2,..) for each single

Re: [R] Writing Macros for RExcel

2011-04-27 Thread Erich Neuwirth
RExcel has its own mailing list (the included documentation says so!) Please subscribe at rcom.univie.ac.at and post your question on that list. On 4/27/2011 8:00 PM, wwreith wrote: I have columns of data in Excel 2007, A2:A196, B2:B196...ET2:ET196 that I would like to place into arrays in R.

Re: [R] Hook into Coercion Framework for data.frame

2011-04-26 Thread Erich Neuwirth
statconnDCOM, availagble from rcom.univie.ac.at is a (D)COM server accessing R. rcom (available from CRAN) is an R package which can turn R into a COM server or into a COM client. These tools have their own mailing list which can be subscribed at rcom.univie.ac.at. On 4/26/2011 6:20 PM, Von

Re: [R] Fibonacci

2011-04-20 Thread Erich Neuwirth
The easy solution to compute the Fibonacci numbers is fibo - function(n,a=1,b=1){ if (n == 1) return(a) if (n == 2) return(b) return(fibo(n-1,b,a+b)) } It avoids double recursion. It is, however, not as resource efficient as a loop since R does not do tail recursion elimination. On Apr

Re: [R] RExcel

2011-04-12 Thread Erich Neuwirth
rcom has its own mailing list. Please subscribe at rcom.univie.ac.at and post all questions there. On 4/12/2011 1:04 AM, array chip wrote: Yes, I did, and no error message. And comRegisterRegistry() returns NULL, not sure if that matters John

Re: [R] fonts in mosaic

2011-04-02 Thread Erich Neuwirth
The problem of changing the default font used fpr the windows graphics device seems to be quite complicated. As I wrote already windowsFonts(myfont=Consolas) par(family=myfont) will make the windows graphics device use Consolas as the defaut font for labels. Therefore, a function call like

Re: [R] fonts in mosaic

2011-03-31 Thread Erich Neuwirth
The easiest way of changing the font used for labels by the windows graphics device (opened by a call to windows()) seems to be the following: Let us assume we want to use the font Consolas for all labels: windowsFonts(myfont=Consolas) par(family=myfont) If one later on wants to change the

[R] fonts in mosaic

2011-03-30 Thread Erich Neuwirth
I need to change the font(s) used in mosaic from package vcd. The help file and the vignette do not give very explicit examples for doing that. The easiest solution would be changing the font for everything on the graph: var labels, var names, title, subtitle, and cell labels. What is the easiest

Re: [R] fonts in mosaic

2011-03-30 Thread Erich Neuwirth
Achim I simply want to replace the font R uses on mosaic (whatever it is) by a font of my choice (say Calibri or Arial) because I need to embed the R charts in a PowerPoint presentation and want the fonts to match. And I want the most simple way of accomplishing this. I worked my way through the

Re: [R] fonts in mosaic

2011-03-30 Thread Erich Neuwirth
Here is a more complete solution to my problem. The fact that the parameters are called gp_varnames, gp_labels, and gp_text on one hand, but main_gp and and sub_gp on the other hand comes as a surprise when one tries to find a solution. windowsFonts(calibri = windowsFont(Calibri))

[R] ks and contour plot labels

2011-03-22 Thread Erich Neuwirth
Is there an easy way to control the font size for the contour lines in plots of kde objects in package ks? The label size seems not obey the cex parameter (which probably would be the R way of doing it). __ R-help@r-project.org mailing list

Re: [R] One to One Matching multiple vectors

2011-03-16 Thread Erich Neuwirth
y[which(x %in% z)] On 3/16/2011 10:42 AM, Vincy Pyne wrote: Dear R helpers Suppose, x = c(0, 1, 2, 3) y = c(A, B, C, D) z = c(1, 3) For given values of z, I need to the values of y. So I should get B and D. I tried doing y[x][z] but it gives y[x][z] [1] A C

Re: [R] Reg : Using R in Web

2011-03-13 Thread Erich Neuwirth
Assuming you are using a Windows based server have a look at statconnWS at rcom.univie.ac.at Warning: statconnWS is NOT open source. It is under development, and it also will work under Linux in the future. The statconnDCOM server also might be an option for you. It is available from the same web

Re: [R] Difference in numeric Dates between Excel and R

2011-03-02 Thread Erich Neuwirth
A detailed description of the Excel problem as seen through the eyes of MS can be found at http://support.microsoft.com/kb/214326 On 3/2/2011 8:15 AM, Prof Brian Ripley wrote: ## Excel is said to use 1900-01-01 as day 1 (Windows default) or ## 1904-01-01 as day 0 (Mac default), but

Re: [R] Generating uniformly distributed correlated data.

2011-02-22 Thread Erich Neuwirth
You do not need the regions with the double densities near the center (1/2,1/2), you can use just the parallel 45 degree borders in that region also. x-x |/*\\\| |---/***\\| |--/*\| |-/**/|

Re: [R] Generating uniformly distributed correlated data.

2011-02-21 Thread Erich Neuwirth
hw-function(r){ (3-sqrt(1+8*r))/4 } x-runif(1000) y-(x+runif(1000,-hw(0.5),hw(0.5))) %% 1 x and y will have correlation 0.5 and will be uniformly distributed on the unit interval. Replacing 0.5 by any nonnegative number r between 0 and 1 will create correlated uniformly distributed

Re: [R] Generating uniformly distributed correlated data.

2011-02-21 Thread Erich Neuwirth
We want to generate a distribution on the unit square with the following properties * It is concentrated on a reasonable subset of the square, and the restricted distribution is uniform on this subset. * Both marginal distributions are uniform on the unit interval. * All horizontal and all

Re: [R] monitor variable change

2011-02-16 Thread Erich Neuwirth
You could use any of the gui toolkits (tcltk, gWidgets ...) and create a watch window which displays the changing value of your variable in a popup widged. On 2/16/2011 10:54 AM, Rainer M Krug wrote: On 02/16/2011 10:38 AM, Alaios wrote: Dear all I would like to ask you if there is a way in R

Re: [R] Writing do and resample functions

2011-01-04 Thread Erich Neuwirth
It seems that the textbook workspace you are using as a method definition for * for class repeater. Load the workspace and try methods(`*`) If you get something like '*.repeater' this suspicion is confirmed On 1/4/2011 11:36 AM, Ben Ward wrote: Hi, I'm trying to take a function from a

[R] [R-pkgs] ENmisc_1.0

2011-01-04 Thread Erich Neuwirth
ENmisc contains two utility function mtapply is a hybrid of mapply and tapply. It evaluates summary function for each cell of data defined by a fixed set of factor values. The reason I wrote it was to be able to compute weighted means (using wtd.mean from Hmisc) to groups of data defined by

Re: [R] Trying to extract an algorithm from a function

2011-01-01 Thread Erich Neuwirth
vars:::predict.vec2var vars:::predict.varest On 12/29/2010 9:31 PM, CALEF ALEJANDRO RODRIGUEZ CUEVAS wrote: Hi, I'm using package vars and I'm trying to extract the algorithm that function predict contained in that package in order to understand how does it work. When I type function VAR

Re: [R] RExcel doesn't get active dataset

2011-01-01 Thread Erich Neuwirth
Please subscribe to the rcom mailing list at rcom.univie.ac.at RExcel questions are handled on that list. On 12/20/2010 9:24 PM, jryan.dani...@gmail.com wrote: Hey everyone When I try to 'get active dataframe' from the context menu in excel using Rcmdr menus in excel, only the header and

Re: [R] editor for MacOS

2010-12-16 Thread Erich Neuwirth
TextMate from www.macromates.com is a very nice editor, similar in power to Emacs, but much more Macish. It has its own subculture with many macro packages. It is NOT free, but not very expensive either. redcar available from http://redcareditor.com/ open source sibling of TextMate running on

Re: [R] how to divide each column in a matrix by its colSums?

2010-11-28 Thread Erich Neuwirth
sweep(m,1,rowSums(m),/) sweep(m,2,colSums(m),/) On 11/28/2010 9:55 PM, casperyc wrote: In that case, there are values 1, which is clearly not what I wanted. Thanks. I think I should use prop.table __ R-help@r-project.org mailing list

Re: [R] Rexcel

2010-11-22 Thread Erich Neuwirth
a) RExcel has its own mailing list (as the documentation tell you). Please post RExcel related questions to the mailing list accessible at rcom.univie.ac.at b) For running code at startup, you have to create a worksheet (not a workbook) named RCode in your workbook. On 11/22/2010 7:15 PM,

Re: [R] Integrating functions / vector arithmetic

2010-11-19 Thread Erich Neuwirth
://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 Center for Computer Science Didactics and Learning

Re: [R] Rserve alternative?

2010-11-08 Thread Erich Neuwirth
You might want to look at statconnWS (available from rcom.univie.ac.at). Warning: This project is not open source. On 11/8/2010 12:40 PM, Ralf B wrote: The Rserve documentation at http://rosuda.org/Rserve/doc.shtml#start states that even when making multiple connections to the Rserve,

Re: [R] How to eliminate this for loop ?

2010-11-08 Thread Erich Neuwirth
Reduce(function(x1,x2)b*x1-x2,c,init=1,accum=TRUE) might be what you are looking for. This is not fully tested, so you should test it before you want to use it. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do

Re: [R] how to save this result in a vector

2010-11-01 Thread Erich Neuwirth
My guess is that what you want probably is best done by using ecdf. You might want to look it up in the docs. 1-ecdf(test)(x) Will give you the percentage of values in test larger than x. On 11/1/2010 2:24 AM, Changbin Du wrote: Thanks Joshua! Yes, i is not going up sequentially by 1, as i

Re: [R] R-Excel Macro mode

2010-10-27 Thread Erich Neuwirth
RExcel has its own mailing list, rcom-l. Please subscribe on rcom.unvie.ac.at and post your question on that list. On 10/27/2010 1:29 PM, Puijman, R. wrote: I'm using R-Excel's macro mode to make an R based Excel tool for inventory management. It's quite a lot of R-code which I made in R at

Re: [R] Extracting elements from a nested list

2010-10-19 Thread Erich Neuwirth
On Oct 18, 2010, at 1:33 PM, Erich Neuwirth wrote: You probably need mapply since you have 2 list of arguments which you want to use in sync mapply(function(x1,x2)x1[[x2]],all.predicted.values,max.growth) might be what you want. On Oct 18, 2010, at 5:17 PM, Gregory Ryslik wrote

Re: [R] Implementing R's recycling rule

2010-10-19 Thread Erich Neuwirth
On 10/19/2010 11:47 AM, Rainer M Krug wrote: x[n %% length(x)] gives you the same answer as rep(x, length.out=n)[n], without having to create the longer vector. n %% length(x) may return 0 and in that case, x[n %% length(x)] will not give the result you expect. x[((n - 1) %% length(x)) +

Re: [R] Extracting elements from a nested list

2010-10-18 Thread Erich Neuwirth
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 and Institute for Scientific Computing University of Vienna [[alternative HTML

[R] file.info returning NA

2010-10-07 Thread Erich Neuwirth
Windows 7, R-2.11.1 and R-2.12.0beta When I do file.info(list.files(getwd())) I get what I expect, a dataframe with a lot of variables, especially isdir, which tells me if the named object is a file or a directory. In the result of file.info(list.files(paste(R.home(),library,sep=/))) all

Re: [R] rcom and safearray type of data

2010-09-22 Thread Erich Neuwirth
rcom has its own mailing list. Please subscribe to this list at rcom.univie.ac.at and post your question there. On 9/21/2010 2:53 PM, Alex Bird wrote: Hello there, I started to use rcom package and there were no problems until I tried to call some external function (method) which returns

Re: [R] Help!

2010-09-20 Thread Erich Neuwirth
If you assume that the variance is the same in all your subsets, you can do an lm analysis with your subset classification as a factor. You could also analyze the interaction between factors and between factors and your numeric independent variable. You also should consider repeated measurement

Re: [R] easiest way to write an R dataframe to excel?

2010-08-23 Thread Erich Neuwirth
Search for an older message with the subject line [R] export tables to excel files on multiple sheets with titles for each table On 8/23/2010 11:41 PM, Erik Iverson wrote: In addition to the Wiki already mentioned, the following may be useful:

Re: [R] RExcel: Sctools not available

2010-08-09 Thread Erich Neuwirth
/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 and Institute for Scientific Computing University of Vienna

Re: [R] reading dates in Excel into R

2010-08-02 Thread Erich Neuwirth
, reproducible code. -- Erich Neuwirth, University of Vienna Faculty of Computer Science Center for Computer Science Didactics and Learning Research Visit our SunSITE at http://sunsite.univie.ac.at Phone: +43-1-4277-39902 Fax: +43-1-4277-39459 __ R-help@r

Re: [R] re. Mathematica and R

2010-07-18 Thread Erich Neuwirth
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 and Institute for Scientific Computing University of Vienna [[alternative HTML version

Re: [R] re. Mathematica and R

2010-07-18 Thread Erich Neuwirth
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 and Institute for Scientific Computing University of Vienna [[alternative HTML version deleted

Re: [R] export tables to excel files on multiple sheets with titles for each table

2010-07-15 Thread Erich Neuwirth
this package to write excel files from linux. http://github.com/armstrtw/Rexcelpoi -- Erich Neuwirth Didactic Center for Computer Science and Institute for Scientific Computing University of Vienna [[alternative HTML version deleted]] __ R

Re: [R] export tables to excel files on multiple sheets with titles for each table

2010-07-14 Thread Erich Neuwirth
://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Erich Neuwirth Didactic Center for Computer Science and Institute for Scientific Computing University of Vienna [[alternative HTML version deleted

Re: [R] Problems installing data package on Windows

2010-06-02 Thread Erich Neuwirth
Did you try using the type=source parameter for install.packages? On Jun 2, 2010, at 3:02 PM, Erick Rocha Fonseca wrote: Dear all, I'm having difficulties installing a package on Windows. It has only R data files, no code. I've built it on a Linux platform and installed it there without

Re: [R] how to profile R interpreter?

2010-05-16 Thread Erich Neuwirth
Look for Rprof in the utils package. On 5/12/2010 9:22 PM, xiaoming gu wrote: Hi, all. Does anyone know how to profile R interpreter? I've tried gprof but it doesn't work. Thanks. Xiaoming -- Erich Neuwirth, University of Vienna Faculty of Computer Science Center for Computer Science

Re: [R] Image into Excel file from R

2010-04-25 Thread Erich Neuwirth
)) } __ 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. -- Erich Neuwirth, University

Re: [R] loops and if statements

2010-04-18 Thread Erich Neuwirth
(a, b) r - ifelse(d[,2] == 'meep', 'oops', 'yay') d - cbind(d, r) d On Sun, Apr 18, 2010 at 5:13 PM, Erich Neuwirth erich.neuwi...@univie.ac.at wrote: for(i in seq(along=d[,2])) {if (d[i,2]==meep) { print(oops)} else { print(yay)} } is probably what you

Re: [R] run R script from Excel VBA

2010-04-18 Thread Erich Neuwirth
at 1:47 PM, Erich Neuwirth erich.neuwi...@univie.ac.at mailto:erich.neuwi...@univie.ac.at wrote: Sub Doit() RInterface.StartRServer RInterface.RRun whateveryoywanttodoinR RInterface.StopRServer End Sub You probably also want some results from R's computation

Re: [R] run R script from Excel VBA

2010-04-16 Thread Erich Neuwirth
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

Re: [R] mantel.haenszel.test for trend in S-plus doesn't work i R

2010-04-04 Thread Erich Neuwirth
-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

Re: [R] RCOM Save

2010-04-01 Thread Erich Neuwirth
/f /im Excel.exe) I tried a lot of possibilities (e. g. in the close statement) but without success. Excel always asks about the saving. -- Erich Neuwirth, University of Vienna Faculty of Computer Science Computer Supported Didactics Working Group Visit our SunSITE at http

Re: [R] Finding positions in array

2010-03-30 Thread Erich Neuwirth
-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@r

Re: [R] Calling R from c in Windows XP

2010-03-27 Thread Erich Neuwirth
, is it possible to write a simple interface using a c dll to call R functions from a Visual Basic.net program? If so, is there a simple example? Thanks to all -- Erich Neuwirth, University of Vienna Faculty of Computer Science Computer Supported Didactics Working Group Visit our SunSITE at http

Re: [R] rpad ?

2010-03-24 Thread Erich Neuwirth
be willing to share your modifications with the list, or at least with me? Thanks, Roger -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Erich Neuwirth Sent: Tuesday, March 23, 2010 4:47 PM To: r-help@r-project.org

Re: [R] rpad ?

2010-03-23 Thread Erich Neuwirth
to our students, but we do not have enough resource to take over maintenance. On 3/23/2010 8:00 PM, sjaffe wrote: Is anyone using rpad? Is there any documentation or examples beyond that in the 'man' directory of the source? -- Erich Neuwirth, University of Vienna Faculty of Computer

Re: [R] Dataframe calculations

2010-03-19 Thread Erich Neuwirth
)), ARRIVALS= as.vector(mapply(function(...)addDelays(...)$arrives,starts,waits,travels))) } -- 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

Re: [R] Dataframe calculations

2010-03-19 Thread Erich Neuwirth
and see why it did not yield the correct results. Thank you, Mike -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Erich Neuwirth Sent: Friday, March 19, 2010 11:38 AM To: r-help@r-project.org Subject: Re: [R] Dataframe

Re: [R] How good is R at making publication quality tables?

2010-03-17 Thread Erich Neuwirth
]] __ 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. -- Erich Neuwirth

  1   2   >