[R] delayedAssign list members

2014-03-04 Thread Shan Huang
I am fascinated by lazy evaluation mechanism provided by delayedAssign. Like delayedAssign(foo, { Sys.sleep(1) # or any other time consuming operations 1 } Time consuming operations will be evaluated only if object foo is used. But when I try: foo - list() foo$bar - 1

Re: [R] sub function problem

2014-03-04 Thread Philippe Grosjean
Hi, Despite OS is not provided, we can guess it is Windows, since Tinn-R works only on Windows. The error message is quite clear, I think: R must start a socket server in order for Tinn-R to communicate with it. Did you look at ?startSocketServer in the svSocket package? Then, you would have a

Re: [R] delayedAssign list members

2014-03-04 Thread Philippe Grosjean
delayedAssign(foo$bar, 2) foo$bar # 1 `foo$bar` # 2 Yes, you assign to the new variable `foo$bar`, not to bar component of the foo variable! You can use an environment for doing what you want: e - new.env() e$bar - 1 delayedAssign(bar, 2, assign.env = e) e$bar But notice also the

[R] alternative to wireframe()

2014-03-04 Thread Rainer M Krug
Hi I am slowly getting enough of wireframe() from the package lattice, as it is to complicated for what I need and does not really do what I want. I am using it to produce a (surprise!) wireframe plot (see example below). The plot function is part of plot.tss in a package which I am working on,

[R] format for as.Date and inserting missing rows in a data frame

2014-03-04 Thread Stefano Sofia
Dear R users, I have a very long data frame (50 years, more than 1.5 million rows) of daily rainfall data from about 80 raingouges. The data frame that I have been given looks like Raingouge_number Station_number Year Month Day Rainfall 2004 2230 1951 1 1 2.60 2004 2230 1951 1 2 0.40 2004 2230

Re: [R] Non-negative solution to an underdetermined linear system

2014-03-04 Thread klqmba
I don't have any cost function to minimize. My task is to create the best matrix, matching the row sums, the column sums, row sumproducts (with the rows from another constant matrix) and also column sumproducts - it's a transportation problem of finding OD matrix corresponding the total tonnage

[R] [R-pkgs] New version of Hmisc package on CRAN

2014-03-04 Thread Frank Harrell
Recent changes include the following. Changes in version 3.14-2 (2014-02-26) * latex.default: improved logic using new function in Misc: latexBuild * latex.default: fixed bug with ctable=TRUE with no caption by removing default label * latex.default: improved formatting for insert.top

[R] [R-pkgs] rms package updated

2014-03-04 Thread Frank Harrell
Changes are listed below. NOTE: The next release of rms will replace the survfit.formula function with a new function named npsurv (nonparametric survival estimates) so as to not conflict with the survival package. This is a NON-DOWNWARD-COMPATIBLE change. To get Kaplan-Meier estimates in

[R] Using indirect arguments in tapply

2014-03-04 Thread Barry King
I am reading parameters from an Excel file but am having trouble using them in tapply. Here is a mini-version of my problem. sorted -

Re: [R] From data frame to time series matrix and plot [UPDATE]

2014-03-04 Thread Rich Shepard
On Mon, 3 Mar 2014, Rich Shepard wrote: I would like to plot (separately) time series for the 'disch' and 'tempMean' columns but have not had success in passing the correct syntax to the plot() function and having the x-axis labels as human-readable dates rather than the epoch time (which is

Re: [R] Using indirect arguments in tapply

2014-03-04 Thread Rui Barradas
Hello, Try instead sMean2 - tapply(parameter[[Pname]], parameter[[Iname]], mean) Hope this helps, Rui Barradas Em 04-03-2014 17:01, Barry King escreveu: I am reading parameters from an Excel file but am having trouble using them in tapply. Here is a mini-version of my problem.

Re: [R] From data frame to time series matrix and plot [UPDATE]

2014-03-04 Thread Rich Shepard
On Tue, 4 Mar 2014, Rich Shepard wrote: Would xyplot() be a better function for these data? Here's the syntax for the xyplot() command; the output is attached. What have I done incorrectly here? xyplot(col.riv.ts, data = NULL, screens = 1, cut = FALSE, auto.key = TRUE) Data:

Re: [R] Using indirect arguments in tapply

2014-03-04 Thread arun
HI, I would use ?with() instead of ?attach. sMean - with(sorted,tapply(PRICE,ITEM,mean)) sMean #Double Single Triple # 352.4 379.9 563.5 parameter - data.frame(Pname,Iname,stringsAsFactors=FALSE) with(sorted,tapply(get(parameter[[Pname]]),get(parameter[[Iname]]),mean)) #Double Single

[R] Shortest connected path in a matrix

2014-03-04 Thread McCloskey, Bryan
I have a binary rectangular T/F matrix; I need to be able to calculate the shortest path (i.e., Pythagorean distance) between a populated cell in row j and any populated cell in some row j+n. For instance, if I have a chessboard with random black/white square colors, I need the shortest distance

Re: [R] From data frame to time series matrix and plot [RESOLVED]

2014-03-04 Thread Rich Shepard
On Mon, 3 Mar 2014, Rich Shepard wrote: I'm missing something simple here so a pointer is needed. Figured it out: I created two ts() objects, one for each parameter, then plotted them using cbind. Just need to tweak how the dates display on the x axis, but that should be doable. Rich

Re: [R] Non-negative solution to an underdetermined linear system

2014-03-04 Thread Berend Hasselman
On 04-03-2014, at 12:38, klq...@mail.bg wrote: I don't have any cost function to minimize. My task is to create the best matrix, matching the row sums, the column sums, row sumproducts (with the rows from another constant matrix) and also column sumproducts - it's a transportation problem

[R] Specifying strip.names in Lattice plots

2014-03-04 Thread Rich Shepard
I've read Deepayan's book, ?strip, and ?strip.default, without learning how to specify strip names on xyplots. The following command produces the attached plot: xyplot(cbind(dalles.disch.ts, dalles.temp.ts), strip.left, main = Columbia River @ The Dalles, xlab = Date (Year.Month), ylab =

Re: [R] How to set up the plot region

2014-03-04 Thread 张以春
Hi, Jim Thank you very much for your suggestion. But, x11() seems to be invalid for my computer. I have tried to use mar() to resolve this question. Thanks a lot. Best, Yichun -原始邮件- 发件人: Jim Lemon j...@bitwrit.com.au 发送时间: 2014年3月4日 星期二

Re: [R] phlyloclim help

2014-03-04 Thread Clint Bowman
I suspect the space in the filename could be the throwing the parser off--you may need some around the filename or fill the space with an underscore. Clint Clint BowmanINTERNET: cl...@ecy.wa.gov Air Quality Modeler INTERNET: cl...@math.utah.edu

[R] [R-pkgs] New package on CRAN: greport

2014-03-04 Thread Frank Harrell
The first submission of the new greport package is now on CTAN. This package facilitates graphical reporting of clinical trials an is highly tied to LaTeX, Hmisc, and lattice. It creates hyperlinks and pop-up tooltips in the resulting pdf report. Tables are greatly de-emphasized, but

Re: [R] Specifying strip.names in Lattice plots

2014-03-04 Thread Duncan Mackay
Hi Rich The first arguments for strip.default are which.given, which.panel, var.name, factor.levels, which means they take the names from the factors of each strip without a reproducible example here is something that may help data(esoph) levels(esoph$alcgp) xyplot(ncontrols

[R] (no subject)

2014-03-04 Thread Agony
Dear all, I have a problem reading xlsx files in R. Could anybody help me how to resolve the problem? install.packages(xlsx, dependencies=TRUE) library(xlsx) library(rJava) data - read.xlsx(3.1.xlsx, sheetIndex = 3.1) data - read.xlsx(3.1.xlsx, sheetName= a,as.data.frame=TRUE, header=TRUE) data

[R] Numbers at risk below cumulative incidence function plot

2014-03-04 Thread Sophia J
Hi guys I am using cmprsk-package for CIF plot but I would like to plot the numbers at risk for the different causes of failure at specific timepoints below a cumulative incidence function plotIs anybody know how can I make that plot or which package shall I use to make it?Thanks in advance!

Re: [R] format for as.Date and inserting missing rows in a data frame

2014-03-04 Thread arun
Hi, May be this helps: dat - read.table(text=Raingouge_number Station_number Year Month Day Rainfall 2004 2230 1951 1 1 2.60 2004 2230 1951 1 2 0.40 2004 2230 1951 1 3 0.00 2004 2230 1951 1 4 0.00 2004 2230 1951 1 5 0.20 2004 2230 1951 1 6 0.00 2004 2230 1951 1 7 0.00 2004 2230 1951 1 9 0.00 2004

[R] Building R for better performance

2014-03-04 Thread Anspach, Jonathan P
Greetings, I'm a software engineer with Intel. Recently I've been investigating R performance on Intel Xeon and Xeon Phi processors and RH Linux. I've also compared the performance of R built with the Intel compilers and Intel Math Kernel Library to a default build (no config options) that

Re: [R] reshape non-square matrix

2014-03-04 Thread Chirag Gupta
This takes away names of all the variables On Sat, Mar 1, 2014 at 9:30 AM, arun smartpink...@yahoo.com wrote: Hi, You could try: #If mat1 is the matrix dimnames(mat1) - list(1:nrow(mat1),1:ncol(mat1)) setNames(as.data.frame.table(mat1),c(m,n,value)) A.K. On Friday, February 28, 2014

[R] cross validation with variables which have one factor only

2014-03-04 Thread Maik Rehnus
Dear R-team I did a model selection by AIC which explain me the habitat use of my animals in six different study sites (See attached files: cross_val_CORINE04032014.csv and cross_val_CORINE04032014.r). Sites were used as random factor because they are distributed over

Re: [R] reshape non-square matrix

2014-03-04 Thread arun
Hi, You didn't provide any reproducible example to start with. Using Jeff's example mx - matrix( 1:12, nrow=3 ) dimnames(mx) - list(1:nrow(mx),1:ncol(mx)) ## setNames(as.data.frame.table(mx),c(m,n,value))   m n value 1  1 1 1 2  2 1 2 3  3 1 3 4  1 2 4 5  2 2 5 6  3 2

[R] Is this a mistake in 'An Introduction to R'?

2014-03-04 Thread Geoff Loveman
In 'An Introduction to R', section 11.7 on nonlinear least squares fitting, the following example is given for obtaining the standard errors of the estimated parameters: To obtain the approximate standard errors (SE) of the estimates we do: sqrt(diag(2*out$minimum/(length(y) - 2) *

Re: [R] problem with previous code

2014-03-04 Thread arun
Hi Elio, If you change the last line of the code: m1[indx2N] - m2[indx1] to m1[indx2N] - m2[sort(indx1)]  sum(m1[rownames(m1)==p79,]) #[1] 191  sum(m2[rownames(m2)==p79,]) #[1] 191 The problem is in the order of the colnames/rownames in each of the datasets.  I tested it on something

Re: [R] reshape non-square matrix

2014-03-04 Thread Chirag Gupta
Jeff This works fine for smaller ones but I have a big dataframe. Its ~35000 X 30. When I try this command, it says Using as id variables. Thank you. On Sat, Mar 1, 2014 at 12:38 AM, Jeff Newmiller jdnew...@dcn.davis.ca.uswrote: library(reshape2) mx - matrix( 1:12, nrow=3 ) mxdf - melt(

Re: [R] format for as.Date and inserting missing rows in a data frame

2014-03-04 Thread PIKAL Petr
Hi -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Stefano Sofia Sent: Tuesday, March 04, 2014 11:58 AM To: r-help@r-project.org Subject: [R] format for as.Date and inserting missing rows in a data frame Dear R users, I

Re: [R] reshape non-square matrix

2014-03-04 Thread Jeff Newmiller
On Tue, 4 Mar 2014, Chirag Gupta wrote: Jeff This works fine for smaller ones but I have a big dataframe. Its ~35000 X 30. When I try this command, it says Using  as id variables. Thank you. You asked for a solution regarding a matrix. Now you talk about data frames. And in responding to