Re: [R] The end of Matlab

2008-12-11 Thread Duncan Murdoch
On 11/12/2008 9:45 PM, Mike Rowe wrote: Greetings! I come to R by way of Matlab. One feature in Matlab I miss is its "end" keyword. When you put "end" inside an indexing expression, it is interpreted as the length of the variable along the dimension being indexed. For example, if the same fea

Re: [R] generate combination multiset (set with repetition)

2008-12-11 Thread Reuben Cummings
Thanks!!! works perfectly. I'll use t(rmultinom(x, m, rep(1,n))/m) for now and look up in my stats book the formula for determining the number of sample sizes to achieve a given p level. The second question was more pertaining to how many combinations are too many to attempt to calculate every poss

Re: [R] Writing a Long across the network?

2008-12-11 Thread Prof Brian Ripley
On Fri, 12 Dec 2008, Saptarshi Guha wrote: Hello, I have to write single Long to a server written in java. The server passes the input as in.readLong() // it expects to receive 8 bytes In Python, i can do it by sending struct.pack( "!q", value) However, I have

[R] Writing a Long across the network?

2008-12-11 Thread Saptarshi Guha
Hello, I have to write single Long to a server written in java. The server passes the input as in.readLong() // it expects to receive 8 bytes In Python, i can do it by sending struct.pack( "!q", value) However, I have tried this writeBin(length(

[R] Is there anyone in charge of package wmtsa ?

2008-12-11 Thread mauede
Here is another occurrence of wmTSA internal error. My time series is a short breathing cycle (2425-Cyle_9.txt). Since wmtsa functions that extract extrema seem to expect longer series than I have, I tried the folowing two tricks: 1) I prolong the 1-cycle series on both ends through duplicating t

Re: [R] rpy2 -- show console window

2008-12-11 Thread Prof Brian Ripley
Please don't multiple post, and I believe Rpy has its own help list. As I understand it, Rpy[2] is an embedded R, in which case there is no R console. But ask the authors/maintainers (as the R posting guide suggested). On Thu, 11 Dec 2008, Karsten Weinert wrote: Hello, from my text editor

Re: [R] The end of Matlab

2008-12-11 Thread Gabor Grothendieck
Its been pointed out to me that the second one is wrong. It should be: tail(this.matrix, -2)[, ncol(this.matrix)] which is not as compact as matlab or my prior post but still not particularly onerous. On Thu, Dec 11, 2008 at 11:49 PM, Gabor Grothendieck wrote: > Use tail and head. See interspe

[R] spatial AR and ARIMA

2008-12-11 Thread Erin Hodgess
Dear R People: Are there functions for spatial AR and ARIMA models in R, please? Thanks, Sincerely, Erin -- Erin Hodgess Associate Professor Department of Computer and Mathematical Sciences University of Houston - Downtown mailto: erinm.hodg...@gmail.com __

Re: [R] The end of Matlab

2008-12-11 Thread Gabor Grothendieck
Use tail and head. See interspersed. On Thu, Dec 11, 2008 at 9:45 PM, Mike Rowe wrote: > Greetings! > > I come to R by way of Matlab. One feature in Matlab I miss is its > "end" keyword. When you put "end" inside an indexing expression, it > is interpreted as the length of the variable along th

[R] The end of Matlab

2008-12-11 Thread Mike Rowe
Greetings! I come to R by way of Matlab. One feature in Matlab I miss is its "end" keyword. When you put "end" inside an indexing expression, it is interpreted as the length of the variable along the dimension being indexed. For example, if the same feature were implemented in R: my.vector[5:e

Re: [R] generate combination multiset (set with repetition)

2008-12-11 Thread Reuben Cummings
Good point, I actually thought about doing some kind of sampling before, but now I think I don't have a choice. Essentially, what I am doing is calculating possible asset allocation possibilities, e.g. N is the number of available assets and M is the available buckets of money to spend on the asse

[R] setting the R_Libs gives warning message from Rgui.exe

2008-12-11 Thread Daren Tan
Hi, I keep getting the error message and a pop-up window for selecting CRAN mirror server from Rgui.exe after setting the R_Libs Warning in install.packages(necessary[!installed], dep = T) : argument 'lib' is missing: using 'D:/Program Files/R/R-2.8.0.libs' --- Please select a CRAN mirror

Re: [R] check if a certain ... argument has been passed on to my user-defined function

2008-12-11 Thread Matthias Kohl
and take a look at ?hasArg hth, Matthias Charles C. Berry wrote: See ?match.call and note the expand.dots arg. HTH, Chuck On Thu, 11 Dec 2008, Mark Heckmann wrote: Hi, How can I check if a certain ... argument has been passed on to my user-defined function or not? foo <- functio

Re: [R] generate combination multiset (set with repetition)

2008-12-11 Thread G. Jay Kerns
Reuben, On Thu, Dec 11, 2008 at 9:28 PM, Reuben Cummings wrote: > Good point, I actually thought about doing some kind of sampling > before, but now I think I don't have a choice. Essentially, what I am > doing is calculating possible asset allocation possibilities, e.g. > > N is the number of av

Re: [R] How to Break Axis in Lattice Plot

2008-12-11 Thread Larry Ma
Thank you very much for the suggestion. I did check into your sample codes: it creates an factor for the xyplot to condition on. However, this causes a problem as I have already other factor(s) to conditon on. I figured out a hard way but using the grid.text inserting "//" at the physical locat

Re: [R] Resampling physiological data using R?

2008-12-11 Thread Gabor Grothendieck
Here some sample code to interpolate your data using zoo: by5 is a sequence for every 5 time units which we merge with z, the original data. Then we use na.approx to replace all NAs with linear interpolations. Lines <- "TimeCursorX CursorY Pupilsize 1811543 -1 -1 -1 1811563 -1

Re: [R] missing argument

2008-12-11 Thread jonas garcia
Thank you all for the replies. Problem soved! J On 12/10/08, Bert Gunter wrote: > > I believe the usual practice in this case is simply to give default values > for arguments: > function(x, y, opt.arg1 = 0, opt.arg2 = sin(1),...) > > If you haven't already done so, perusal of "An Introduction to

Re: [R] X11 not being detected whilst installing "rgl" package

2008-12-11 Thread Duncan Murdoch
On 11/12/2008 7:23 PM, ekwaters wrote: Any ideas? I certainly have X11, I have tried copying it into other directories. At present it is in /etc/X11. You probably don't have the development package for X, with headers, etc. rgl uses the standard autoconf search for the headers. Duncan Murdo

Re: [R] How do I tapply to a data frame with arbitrary column labels?

2008-12-11 Thread Gabor Grothendieck
Look at rowsum or aggregate: > Lines <- "classpigeonfalconpropellerjetwingfly + birds25 37 00 21 + planes 0 128 4013 + birds19 41 01

[R] X11 not being detected whilst installing "rgl" package

2008-12-11 Thread ekwaters
Any ideas? I certainly have X11, I have tried copying it into other directories. At present it is in /etc/X11. This is my error message. /home/user> R CMD INSTALL -l [/usr/local/R/site-library] rgl_0.81.orig.tar.gz * Installing *source* package 'rgl' ... checking for gcc... gcc -std=gnu99 checki

Re: [R] How to generate a prediction equation for a stratified survival model that was fitted by cph() in Design package

2008-12-11 Thread Frank E Harrell Jr
Yu, Changhong wrote: Dear all, I used cph() function from Frank harrell's Design package to create a survival model, then used functions 'Function' and 'sascode' to generate prediction equation based on the saved survival model. But it failed. I included a stratified variable in the model. If I

Re: [R] Writing multiple matrices

2008-12-11 Thread Jorge Ivan Velez
Dear Carlos, Try this: # Working directory setwd("C:/") # Generating 10 files sapply(1:10, function(x){ # Create X X= matrix(rnorm(100),ncol=10) # Write X write.table(X, paste('my_matrix_',x,'.dat',sep=""), quote=FALSE,sep='\t',col.names=FALSE,row.name

Re: [R] generate combination multiset (set with repetition)

2008-12-11 Thread G. Jay Kerns
Dear Reuben, [snip] > my questions now are... how would I generalize functions 3 and 4 for m > And, which of the 4 functions would be best for varying ranges of > n and m? I am expecting values for n to range between 1 and 1e3, while > m will range between 1 and 1e6. > > Reuben > Regarding your

Re: [R] candisc plotting

2008-12-11 Thread Michael Friendly
Dear Pete, You haven't told us what your data is, and we can only surmise -- not very helpful for you and annoying for those who try to help. Pete Shepard wrote: Hello, I have a file with two dependent variables (three and five) and one independent variable. I do i.mod <- lm(cbind(three, fi

[R] How do I tapply to a data frame with arbitrary column labels?

2008-12-11 Thread Bill McNeill (UW)
I have a data file that looks like this classpigeonfalconpropellerjetwingfly birds25 37 00 21 planes 0 128 4013 birds19 41 01 4

[R] Writing multiple matrices

2008-12-11 Thread Carlos López
Hello all :) I have a for loop where in each cycle I create certain matrix object, let´s say, X, I would like to write it so I use the write.table function but I would like to write as many matrices as cycles, this is, I would like to use a variable, let´s say y, that will be in the for, as in:

Re: [R] recursive term

2008-12-11 Thread andrew
you might try the following. Pochhammer_n <- function (a,b,c,n) { if(n==0) return(1) return(a*b*Pochhammer_n(a+1, b+1, c+1, n-1)/(c*n)) } hypergeo_sum <- function (a,b,c,z,n) { comb_sum <- 0 for (i in 0:n) { comb_su

[R] rpy2 -- show console window

2008-12-11 Thread Karsten Weinert
Hello, from my text editor (on winxp) I interact with R using the python module rpy2. This works nice for plot commands, i.e. a window opens and shows the plot. It also works nice for the file.show command. Sometimes, however, I would like to see the console window. Is there a way to make rpy2 sh

Re: [R] generate combination multiset (set with repetition)

2008-12-11 Thread Reuben Cummings
Thanks for the suggestions!! I upgraded R which solved a few of my problems and got the following functions to work: # works for m > 2 # requires {prob] multisets1 <- function(n, m) { as.matrix(urnsamples(1:n, size = m, ordered = FALSE, replace = TRUE)) } # works for m > 2 # requires {mu

[R] How to generate a prediction equation for a stratified survival model that was fitted by cph() in Design package

2008-12-11 Thread Yu, Changhong
Dear all, I used cph() function from Frank harrell's Design package to create a survival model, then used functions 'Function' and 'sascode' to generate prediction equation based on the saved survival model. But it failed. I included a stratified variable in the model. If I removed the stratificat

[R] negative binomial lmer

2008-12-11 Thread Marty Kardos
Hi; I am running generalized linear mixed models (GLMMs) with the lmer function from the lme4 package in R 2.6.2. My response variable is overdispersed, and I would like (if possible) to run a negative binomial GLMM with lmer if possible. I saw a posting from November 15, 2007 which indicated tha

Re: [R] is there a way to recursilvely lapply

2008-12-11 Thread Whit Armstrong
yes, that is correct. I was looking in text mode. ok, thanks for your help. -Whit On Thu, Dec 11, 2008 at 4:02 PM, Prof Brian Ripley wrote: > On Thu, 11 Dec 2008, Whit Armstrong wrote: > >> Thanks, Gabor and Prof. Ripley. >> >> Sorry for the oversight. >> >> I grepped the lapply help for recur

Re: [R] Resampling physiological data using R?

2008-12-11 Thread Mike Lawrence
This has been solved in an earlier post: http://www.nabble.com/linear-interpolation-of-multiple-random-time-series-to11694879.html On Thu, Dec 11, 2008 at 4:38 PM, tsunhin wong wrote: > Dear all R users, > > I am going to use R to process some of my physiological data about eye. > > The problem

Re: [R] R imperfections? -- was: repeated searching of no-missing values

2008-12-11 Thread Stavros Macrakis
Bert has pointed out to me that the R definition of "deprecated" is considerably more draconian than that in most other systems: ? Deprecated "These functions are provided for compatibility with older versions of *R* only, and may be defunct as soon as the next release." I would certain

Re: [R] Error fitting ZIP with zeroinfl()

2008-12-11 Thread Achim Zeileis
On Thu, 11 Dec 2008, Paige Barlow wrote: I am attempting to fit a full zero-inflated Poisson model then use backward elimination to arrive at the best-fitting model. When I try to fit the model with zeroinfl() I get this error: Error in while (abs((ll_old - ll_new)/ll_old) > control$reltol)

Re: [R] Logical inconsistency

2008-12-11 Thread Bernardo Rangel Tura
On Thu, 2008-12-11 at 17:23 +0200, Kenn Konstabel wrote: > Hi, > > I agree -- and my examples using round were meant as bad and dangerous > examples. Using round at the last step is better and may solve the problem, > but in your example ... > > > round(8.8-7.8,1)==1 > [1] TRUE > > ... you have

Re: [R] rpy2 -- show console window

2008-12-11 Thread Karsten Weinert
Hello, from my text editor (on winxp) I interact with R using the python module rpy2. This works nice for plot commands, i.e. a window opens and shows the plot. It also works nice for the file.show command. Sometimes, however, I would like to see the console window. Is there a way to make rpy2 sh

Re: [R] Row order in plot

2008-12-11 Thread Sarah Goslee
Though the results of using plot() with a factor may not always be what you expect, as plot.factor() differs from plot(). Sarah On Thu, Dec 11, 2008 at 4:36 PM, Peter Alspach wrote: > Tena koe > > Try > > mice$X <- factor(mice$X, levels=mice$X) > plot(Green.1~X,data=mice) > > HTH > > Peter

Re: [R] Row order in plot

2008-12-11 Thread Sarah Goslee
Then yes, you can do something like I originally suggested, though there are other possible approaches. Making up fake data rather than typing yours in: > testdata <- as.data.frame(matrix(1:15, ncol=3)) > testdata <- cbind(c("D", "E", "A", "C", "B"), testdata) > colnames(testdata) <- c("X", "c1",

Re: [R] Row order in plot

2008-12-11 Thread Peter Alspach
Tena koe Try mice$X <- factor(mice$X, levels=mice$X) plot(Green.1~X,data=mice) HTH Peter Alspach > -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of qroberts > Sent: Friday, 12 December 2008 9:12 a.m. > To: r-help@r-proje

[R] Error fitting ZIP with zeroinfl()

2008-12-11 Thread Paige Barlow
I am attempting to fit a full zero-inflated Poisson model then use backward elimination to arrive at the best-fitting model. When I try to fit the model with zeroinfl() I get this error: Error in while (abs((ll_old - ll_new)/ll_old) > control$reltol) { : missing value where TRUE/FALSE n

Re: [R] Extract rows from data frame based on row names from anotherdata frame

2008-12-11 Thread Daniel Malter
Hi #Create data and data frames x=rnorm(5,0,1) y=rnorm(5,0,1) z=rnorm(5,0,1) d1=data.frame(x,y) d2=data.frame(y,z) #which variable name in d2 is a variable name in d1? names(d2[names(d2)%in%names(d1)]) # it's y #give me the columns of d2 that have variable names #that are also variable names in

[R] Combining two/more data.frame with variable column lengths.

2008-12-11 Thread HAROON MALIK.
Hi, i want to combine several data.frames in to one big data.frame. The problem is that length of the column in each data.frame is diffrent. cbind or rbind dont work here. i wrote my own function to solve it which really unefficient. If some has a neat solution, it will be highly appriciated.

Re: [R] Row order in plot

2008-12-11 Thread qroberts
This is the format of the table as it appears in R >mice X Green.1 Yellow.2 Blue.3 Gray.4 1 Base 469.5399 508.1532 487.1443 492.2544 2PBS 459.6553 474.0124 417.2651 392.9518 3 25 Mch 359.6216 418.0417 377.7020 394.2102 4 50 Mch 206.1835 262.8818 252.80

Re: [R] Resampling physiological data using R?

2008-12-11 Thread Charles C. Berry
On Thu, 11 Dec 2008, tsunhin wong wrote: Dear all R users, I am going to use R to process some of my physiological data about eye. The problem is the recording machine does not sample in a reliably constant rate: the time intervals between data sampled can vary from 9msec to ~120msec, while mo

[R] simulate spatial data

2008-12-11 Thread Daniel Malter
Hi, I am simulating 2-dimensional data using the RandomFields library and the gaussRF function therein. While this is done with the code below, I would like the landscape to be continuous or smooth at the edges. That is, I would like the upper edge to smoothly connect to the lower edge AND the righ

[R] Extract rows from data frame based on row names from another data frame

2008-12-11 Thread Wade Wall
Hi all, Is there a function to extract row names from a data frame based on row names from another data frame? I can write a loop function to do this, but this may be inefficient in terms of processing. thanks for any information, Wade __ R-help@r-pr

Re: [R] is there a way to recursilvely lapply

2008-12-11 Thread Prof Brian Ripley
On Thu, 11 Dec 2008, Whit Armstrong wrote: Thanks, Gabor and Prof. Ripley. Sorry for the oversight. I grepped the lapply help for recursive prior to sending my question. why does it appear as "*r*ecursive" in the help file? or is that just a formating problem on my machine? It is marked as

Re: [R] R imperfections? -- was: repeated searching of no-missing values

2008-12-11 Thread Wacek Kusnierczyk
replies inline below. Bert Gunter wrote: > Replies inline below. > > > [bert (?)]...?tapply says that the first argument is an **atomic** > vector. A > factor is not an atomic vector. So tapply interprets it as such by looking > only at its representation, which is as integer values. >

[R] Equivalent to Full Information Maximum Likelihood (FIML) in R?

2008-12-11 Thread Pilgrim Regression
Is there an equivalent to MPlus's Full Information Maximum Likelihood (FIML) missing data estimator for R? If so, is there a way to take covariance structures produced by such a package and perform multiple regression with these? If you are unfamiliar with Mplus' FIML below is a link to their manu

Re: [R] is there a way to recursilvely lapply

2008-12-11 Thread Whit Armstrong
Thanks, Gabor and Prof. Ripley. Sorry for the oversight. I grepped the lapply help for recursive prior to sending my question. why does it appear as "*r*ecursive" in the help file? or is that just a formating problem on my machine? -Whit On Thu, Dec 11, 2008 at 3:13 PM, Prof Brian Ripley wro

[R] Resampling physiological data using R?

2008-12-11 Thread tsunhin wong
Dear all R users, I am going to use R to process some of my physiological data about eye. The problem is the recording machine does not sample in a reliably constant rate: the time intervals between data sampled can vary from 9msec to ~120msec, while most around in the 15-30msec range. The below

Re: [R] 2-Y-axes on same plot

2008-12-11 Thread Robert W. Baer, Ph.D.
Joe Trubisz wrote: Hi... Is this possible in R? I have 2-sets of data, that were collected simultaneously using 2-different data acquisition schemes. The x-values are the same for both. The y-values have different ranges (16.4-37.5 using one method, 557-634 using another). In theory, if yo

Re: [R] R imperfections? -- was: repeated searching of no-missing values

2008-12-11 Thread Stavros Macrakis
Bert, Thanks for your reply. I suspect we agree more than you might think Comments inline below. I've snipped out parts. -s On Thu, Dec 11, 2008 at 2:45 PM, Bert Gunter wrote: > Rationale? -- you'll have to ask the developers Hmm. It would be nice if this could be doc

Re: [R] is there a way to recursilvely lapply

2008-12-11 Thread Prof Brian Ripley
On Thu, 11 Dec 2008, Whit Armstrong wrote: for a simple example: x <- list() x[["a"]] <- list(a=c(1,2,3),b=c(3,4,5)) x[["b"]] <- list(a=c(6,7,8),b=c(9,10,11)) lapply(x,sum) this fails w/ Error in FUN(X[[1L]], ...) : invalid 'type' (list) of argument Just wondering if I have overlooked somet

Re: [R] call lattice function in a function passing "groups" argument

2008-12-11 Thread Deepayan Sarkar
On Thu, Dec 11, 2008 at 2:55 AM, Thomas Zumbrunn wrote: > I'm trying to use a lattice function within a function and have problems > passing the "groups" argument properly. Let's say I have a data frame > > d <- data.frame(x = rnorm(100), y = c("a", "b")) > > and want to plot variable x in a densi

[R] candisc plotting

2008-12-11 Thread Pete Shepard
Hello, I have a file with two dependent variables (three and five) and one independent variable. I do i.mod <- lm(cbind(three, five) ~ species, data=i.txt) and get the following output: Coefficients: three five (Intercept) 9.949 9.586 species -1.166 -1.156 I do a" i.ca

Re: [R] getting ISO week

2008-12-11 Thread Gabor Grothendieck
Perhaps you mean is that the definition ought be otherwise but at least according to one standard the definition is correct: http://www.opengroup.org/onlinepubs/009695399/functions/strptime.html On Thu, Dec 11, 2008 at 3:01 PM, Hans W. Borchers wrote: > Gabor Grothendieck gmail.com> writes: > >

Re: [R] is there a way to recursilvely lapply

2008-12-11 Thread Gabor Grothendieck
This will recursively lapply and may or may not be what you are looking for: rapply(x, sum) On Thu, Dec 11, 2008 at 2:59 PM, Whit Armstrong wrote: > for a simple example: > > x <- list() > x[["a"]] <- list(a=c(1,2,3),b=c(3,4,5)) > x[["b"]] <- list(a=c(6,7,8),b=c(9,10,11)) > > lapply(x,sum) > > >

Re: [R] getting ISO week

2008-12-11 Thread Hans W. Borchers
Gabor Grothendieck gmail.com> writes: > > According to the definition in ?strptime (which is not the same as the > ISO definition): > > format(x, "%W") returns > > "Week of the year as decimal number (00–53) using Monday as the first > day of week (and typically with the first Monday of the ye

[R] is there a way to recursilvely lapply

2008-12-11 Thread Whit Armstrong
for a simple example: x <- list() x[["a"]] <- list(a=c(1,2,3),b=c(3,4,5)) x[["b"]] <- list(a=c(6,7,8),b=c(9,10,11)) lapply(x,sum) this fails w/ Error in FUN(X[[1L]], ...) : invalid 'type' (list) of argument Just wondering if I have overlooked something obvious. one can also do: lapply(x,lapp

Re: [R] Row order in plot

2008-12-11 Thread Sarah Goslee
It would be easier to answer your question if we knew what your data look like, what R commands you've tried, and what result you want. One possibility: plot the data against 1:nrow(yourdata), and add the row names as labels. Sarah On Thu, Dec 11, 2008 at 2:35 PM, qroberts wrote: > > I'm new to

[R] Row order in plot

2008-12-11 Thread qroberts
I'm new to R so forgive me if this seems like a simple question: So I have table where the row titles are string variables. When I plot the data with rows along the x-axis, the data is ordered alphabetically as opposed to the order of the table. How can I preserve the row order of the table in t

[R] R imperfections? -- was: repeated searching of no-missing values

2008-12-11 Thread Bert Gunter
Replies inline below. Best regards, -- Bert ___ From: macra...@gmail.com [mailto:macra...@gmail.com] On Behalf Of Stavros Macrakis Sent: Thursday, December 11, 2008 10:53 AM To: Bert Gunter Cc: Patrizio Frederic; r-help@r-project.org Subject: Re: [R] repeated searchin

Re: [R] getting ISO week

2008-12-11 Thread Gabor Grothendieck
According to the definition in ?strptime (which is not the same as the ISO definition): format(x, "%W") returns "Week of the year as decimal number (00–53) using Monday as the first day of week (and typically with the first Monday of the year as day 1 of week 1). The UK convention." The first da

Re: [R] getting ISO week

2008-12-11 Thread Hans W. Borchers
Gabor Grothendieck gmail.com> writes: > > format(d, "%U") and format(d, "%W") give week numbers using > different conventions. See ?strptime Gabor, the results of format(aDate, "W") appear to be incorrect anyway, see: format(as.Date("2008-01-01"), "%W") #-> "00" There is never a wee

Re: [R] check if a certain ... argument has been passed on to my user-defined function

2008-12-11 Thread Charles C. Berry
See ?match.call and note the expand.dots arg. HTH, Chuck On Thu, 11 Dec 2008, Mark Heckmann wrote: Hi, How can I check if a certain ... argument has been passed on to my user-defined function or not? foo <- function(data, ...) { ### here I want to check whether xlab was passed

Re: [R] check if a certain ... argument has been passed on to my user-defined function

2008-12-11 Thread Henrique Dallazuanna
Try this: foo <- function(data, ...) { ### here I want to check whether xlab was passed with the ... arguments ### or if the ... arguments did not contain an xlab argument args <- list(...) return(ifelse("xlab" %in% names(args), "Exists", "Missing")) } On Thu, Dec 11, 2008 at 4:22 PM, Mark Heckma

[R] check if a certain ... argument has been passed on to my user-defined function

2008-12-11 Thread Mark Heckmann
Hi, How can I check if a certain ... argument has been passed on to my user-defined function or not? foo <- function(data, ...) { ### here I want to check whether xlab was passed with the ... arguments ### or if the ... arguments did not contain an xlab argument } I tried missing(xlab) , exist

Re: [R] repeated searching of no-missing values

2008-12-11 Thread Stavros Macrakis
On Wed, Dec 10, 2008 at 6:39 PM, Bert Gunter wrote: > ...?tapply says that the first argument is an **atomic** vector. A factor > is not an atomic vector. So tapply interprets it as such by looking only at > its representation, which is as integer values. > What is the rationale for this? If it

[R] help: programming loop, binding columns between data sets

2008-12-11 Thread Simon Pickett
Hi, I often have the problem of combining data sets of different lengths together. Simple example: I have data frame "a", with two columns "C1" and "C2" and another data frame "b" with only one column "V1". Data frame "b" is much bigger than "a", but "C1" of "a" has the same levels as "V1"

Re: [R] generate combination multiset (set with repetition)

2008-12-11 Thread Charles C. Berry
On Thu, 11 Dec 2008, Reuben Cummings wrote: Hi, This has been asked before but not sufficiently answered from what I could find. How do you create combinations with repetitions (multisets) in R? If I have set <- array(1:3) Why wrap 1:3 in array() ?? And I want to choose all combinations

Re: [R] generate combination multiset (set with repetition)

2008-12-11 Thread G. Jay Kerns
Dear Reuben, On Thu, Dec 11, 2008 at 12:53 PM, baptiste auguie wrote: > Hi, > > Perhaps you can use expand.grid and then remove the mirror combinations, > >> values <- 1:3 >> tmp <- expand.grid(values, values) >> unique.combs <- tmp[tmp[, 1]<=tmp[, 2], ] >> unique.combs[do.call(order, unique.com

[R] Complex integration in R

2008-12-11 Thread Borja Soto Varela
Dear R-user I need a function to approximate a complex integration. My function is: aprox2=function(s,x,rate){ dexp(x,rate)*exp(-s*x) } where argument s is a complex number. I can't use the integrate function because it's only used with "numeric" arguments Does anyone know some function to

[R] how to plot implicit functions

2008-12-11 Thread YIHSU CHEN
Dear R users -- I think this question was asked before but there was no reply to it. I would appreciate any suggestion any of you might have. I am interested in plotting several "implicit functions" (F(x,y,z)=0) on the same fig. Is there anyone who has an example code of how to do this? Than

Re: [R] very long integers

2008-12-11 Thread Stavros Macrakis
If they are IDs, you presumably don't need to perform arithmetic on them, so why not store them as strings? If you're reading them with read.table, see the colClasses parameter. I am not sure how to do this in RODBC; as.isthere (as in read.table) does not affect columns that look like numbers --

Re: [R] Logical "in" test

2008-12-11 Thread Stavros Macrakis
i %in% c(7,10,30,50) On Thu, Dec 11, 2008 at 12:11 PM, David B. Thompson, Ph.D., P.E., D.WRE, CFM wrote: > OK, this should be trivial but I'm not finding it. I want to compress the > test, > > if (i==7 | i==10 | i==30 | i==50) {} > > into something like > > if (i in c(7,10,30,50)) {} > > so I ca

Re: [R] generate combination multiset (set with repetition)

2008-12-11 Thread baptiste auguie
Hi, Perhaps you can use expand.grid and then remove the mirror combinations, values <- 1:3 tmp <- expand.grid(values, values) unique.combs <- tmp[tmp[, 1]<=tmp[, 2], ] unique.combs[do.call(order, unique.combs), ] # reorder if you wish Var1 Var2 111 412 713 522

Re: [R] Principal Component Analysis - Selecting components? + right choice?

2008-12-11 Thread Ravi Varadhan
Hi, It is generally not the case that the best PC set, say, the top k PCs (where k < p, p being the number of predcitors) contain the best predictor subset in linear regression. Hadi and Ling (Amer Stat, 1998) show that it is even possible to have an extreme situation where the first (p-1) PCs co

Re: [R] Logical "in" test

2008-12-11 Thread Seeliger . Curt
> OK, this should be trivial but I'm not finding it. I want to compress > the test, > > if (i==7 | i==10 | i==30 | i==50) {} > > into something like > > if (i in c(7,10,30,50)) {} > > so I can build a "excludes" vector > > excludes <- c(7,10,30,50) > > and test > > if (i in excludes) {} Wo

[R] very long integers

2008-12-11 Thread Aaron Robotham
A quick question really: I have a database with extremely long integer IDs (eg 588848900971299297), which is too big for R to cope with internally (it appears to store as a double), and when I do any frequency tables erroneous results appear. Does anyone know of a package that extends int

[R] problem with legend

2008-12-11 Thread valeria pedrina
hi all, I want to do a plot and put the legend on the left of y axis this is my code: x<-seq(1980,2005,1) plot(x,tfa_ita,type="l",col=1,xlim=c(1979,2005),ylim=c(0.2,1.7),xlab="",ylab="",main="Totale Attivita` Finanziarie") lines(x,tfa_spa,type="l",col=2) lines(x,tfa_aus,type="l",col=3) lines(x,tf

[R] generate combination multiset (set with repetition)

2008-12-11 Thread Reuben Cummings
Hi, This has been asked before but not sufficiently answered from what I could find. How do you create combinations with repetitions (multisets) in R? If I have > set <- array(1:3) And I want to choose all combinations of picking 2 numbers, I want to get a print out like [,1] [,2] [1,]

Re: [R] Logical "in" test

2008-12-11 Thread Gustavo Carvalho
Take a look at ?any. On Thu, Dec 11, 2008 at 3:11 PM, David B. Thompson, Ph.D., P.E., D.WRE, CFM <[EMAIL PROTECTED]> wrote: > OK, this should be trivial but I'm not finding it. I want to compress the > test, > > if (i==7 | i==10 | i==30 | i==50) {} > > into something like > > if (i in c(7,10,30,50

Re: [R] getting ISO week

2008-12-11 Thread Gustaf Rydevik
On Thu, Dec 11, 2008 at 2:10 PM, Prof Brian Ripley <[EMAIL PROTECTED]> wrote: > A slightly simpler version is > > format(Sys.Date(), "%V") > > > On Thu, 11 Dec 2008, Prof Brian Ripley wrote: > >> strftime(x, "%V") >> >> E.g. >> >> strftime(as.POSIXlt(Sys.Date()), "%V") >> >> is "50", and you might

Re: [R] very long integers

2008-12-11 Thread Rory.WINSTON
Have you looked at the R interface to gmp? http://cran.r-project.org/web/packages/gmp/index.html Rory Winston RBS Global Banking & Markets Office: +44 20 7085 4476 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Aaron Robotham Sent: 11 December 2008 17:

Re: [R] merging data.frames columnwise (rbind with different variables, lengths)

2008-12-11 Thread Dimitris Rizopoulos
have a look at merge(), e.g., df1 <- data.frame(A = c(1,2), B = c("m","f"), C = c("at home", "away")) df2 <- data.frame(A = c(2), C = c("at home")) merge(df1, df2, all = TRUE, sort = FALSE) I hope it helps. Best, Dimitris Stefan Uhmann wrote: Dear List, I have two dataframes with overlapp

[R] help with predict in stats4

2008-12-11 Thread David Kaplan
Hi, We're using stats4 for a logistic regression. The code is chdreg.logit2 <- glm(chd ~ age + sex, family = binomial) summary(chdreg.logit2) oddsratios <- coef(chdreg.logit2) exp(oddsratios) # Calculate model predicted values pred <- predict(chdreg.logit2,type="response") The glm part runs f

[R] Logical "in" test

2008-12-11 Thread David B. Thompson, Ph.D., P.E., D.WRE, CFM
OK, this should be trivial but I'm not finding it. I want to compress the test, if (i==7 | i==10 | i==30 | i==50) {} into something like if (i in c(7,10,30,50)) {} so I can build a "excludes" vector excludes <- c(7,10,30,50) and test if (i in excludes) {} However, I'm not finding a clue

[R] very long integers

2008-12-11 Thread Aaron Robotham
A quick question really: I have a database with extremely long integer IDs (eg 588848900971299297), which is too big for R to cope with internally (it appears to store as a double), and when I do any frequency tables erroneous results appear. Does anyone know of a package that extends int

Re: [R] Validity of GLM using Gaussian family with sqrt link

2008-12-11 Thread Prof Brian Ripley
Please do read the help page: fortune("WTFM") applies. On Thu, 11 Dec 2008, Gerard M. Keogh wrote: Hi all, Just on this question : can I assume any R internal defined function can be used to describe the link (e.g. = "arctan") so long as its increasing and monotone? How might abs work for exa

Re: [R] Extracting the name of an object into a character string

2008-12-11 Thread Dimitris Rizopoulos
do you mean something like the following: f <- function (x) { deparse(substitute(x)) } x <- 5 y <- 6 z <- 7 f(x) f(y) f(z) I hope it helps. Best, Dimitris Philip Whittall wrote: Dear List, I am writing a function in R with the facility to store models for later use in scoring. It wou

Re: [R] Sorting problem

2008-12-11 Thread ronggui
Sorry for the last post. I didn't use the latest version of R. It works under Linux as well for R-2.8.0 patch. Best On Thu, Dec 11, 2008 at 11:34 PM, ronggui <[EMAIL PROTECTED]> wrote: > Sys.setlocale(,"C") > x1 <- as.character(date()) # I use date to record the time, and save > it to sqlite data

Re: [R] A package to set up a questionnaire & enter data

2008-12-11 Thread CE.KA
Thank you ryancw wrote: > > Not an R package, but EpiData is free software designed to to exactly > this. It's a wonderful piece of software. Define fields, add annotations, > provide defaults, provide allowable values or ranges, calculate one field > based on entry to another, conditional ski

Re: [R] Validity of GLM using Gaussian family with sqrt link

2008-12-11 Thread Gerard M. Keogh
Hi all, Just on this question : can I assume any R internal defined function can be used to describe the link (e.g. = "arctan") so long as its increasing and monotone? How might abs work for example - (except at 0)? And/or finally, can I define any old function in R called "myfun" and use link="

Re: [R] passing on the ... arguments in a progammed graphics function

2008-12-11 Thread Duncan Murdoch
On 12/11/2008 11:01 AM, Mark Heckmann wrote: Hi everyone, I want to write a wrapper function that uses the hist() function. Now I want to allow the hist breaks argument as optional in my function. So when my function contains the breaks argument I want the hist() function to use it, if not, I wa

Re: [R] motif search

2008-12-11 Thread Jean lobry
Dear Alessia, I am very new to R and wanted to know if there is a package that, given very long nucleotide sequences, searches and identifies short (7-10nt) motifs.. I would like to look for enrichment of certain motifs in genomic sequences. I tried using MEME (not an R package, I know), b

Re: [R] ref card for data manipulation?

2008-12-11 Thread Vitalie Spinu
On Thu, 11 Dec 2008 15:19:03 +0100, hadley wickham <[EMAIL PROTECTED]> wrote: You (as many before you) have overlooked the ave() function, which can replace the ordering as well the do.call(c,tapply()) Majority of questions on this list concern data manipulation. Many are repetitive. "Ove

Re: [R] Downloading Reuters data from R

2008-12-11 Thread Tony Breyal
Hi Shubha, I'm replying offlist because although I don't have an answer to your question, i thought i would point you in the direction of Rmetrics (http://www.rmetrics.org/rmetricsPackages.htm) as there might be something in there that may be helpful if you don't get a more direct answer from your

Re: [R] Downloading Reuters data from R

2008-12-11 Thread Rory.WINSTON
Hi Shubha I have created an extension DLL for downloading time series data from Reuters. You can download it from here: http://www.theresearchkitchen.com/blog/archives/287 There is also a short manual available at the same location: http://www.theresearchkitchen.com/blog/wp-content/uploads/200

  1   2   >