Re: [R] Getting sink to work with message on R 2.11.0 - what didI miss?

2010-05-26 Thread Tal Galili
Hello Greg, Thank you for the coding. A few questions and remarks: 1) I have a feature request that I believe Faiz is interested in: He would like to have the formatting of tables/data.frames in the output to be prettier then the one extracted from the console output. I wonder if that is

[R] Avoiding Loops When Iterating Over Statement That Updates Its Input

2010-05-26 Thread Alan Lue
Since `for' loops are slow in R, and since `apply' functions are faster, I was wondering whether there were a way to use an apply function—or to otherwise avoid using a loop—when iterating over a statement that updates its input. For example, here's some such code: r.seq - 2 * (1 / d$Dt[1] - 1)

Re: [R] Avoiding Loops When Iterating Over Statement That Updates Its Input

2010-05-26 Thread Alan Lue
Come to think of it, we can't save the output of each invocation and concatenate it later, since we need the output as input for the next iteration. Alan On Tue, May 25, 2010 at 11:43 PM, Alan Lue alan@gmail.com wrote: Since `for' loops are slow in R, and since `apply' functions are

[R] Hgu133acdf Installation Problem

2010-05-26 Thread mahalakshmi sivamani
Hi, While trying to install hgu133acdf- windows package in R im getting the following error and unable to install the same. source(http://bioconductor.org/biocLite.R;) biocLite(hgu133acdf) Using R version 2.10.0, biocinstall version 2.5.10. Installing Bioconductor version 2.5 packages: [1]

Re: [R] Counting indexes

2010-05-26 Thread Alan Lue
x - rle(id) cumsum(x$lengths) - (x$lengths - 1) cumsum(x$lengths) Alan On Tue, May 25, 2010 at 10:00 PM, Gabor Grothendieck ggrothendi...@gmail.com wrote: This assumes that for a particular id they all occur together in a run: cbind(start = which(!duplicated(id)), end = which(!duplicated(id,

[R] writing function : can't find an object

2010-05-26 Thread arnaud Gaboury
Dear group, Here is my function: #return the daily PL for day y PLDaily-function(x,y) { #find elements in my directory with LSCPos in the name, keep the numeric part in the name and #create a list l-gsub(\\D,,dir()[grep(LSCPos,dir())]) #select in the list the desired elements

Re: [R] Getting sink to work with message on R 2.11.0 - what didI miss?

2010-05-26 Thread Henrik Bengtsson
On Wed, May 26, 2010 at 8:26 AM, Tal Galili tal.gal...@gmail.com wrote: Hello Greg, Thank you for the coding. A few questions and remarks: 1) I have a feature request that I believe Faiz is interested in: He would like to have the formatting of tables/data.frames in the output to be

[R] Factor to Numeric

2010-05-26 Thread Mohan L
Dear All, I have a data frame with State and 12 Months as column. I want to convert all the 12 month column from factor to numeric. any help will be greatly appreciated. str(data) 'data.frame':33 obs. of 9 variables: $ State: Factor w/ 33 levels Andaman and Nicobar Islands,..: 1 2 3 4

Re: [R] Calculation time of isoMDS and the optimal number of dimensions

2010-05-26 Thread Gavin Simpson
On Tue, 2010-05-25 at 19:00 +0200, Joris Meys wrote: Dear all, I'm running a set of nonparametric MDS analyses, using a wrapper for isoMDS, on a 800x800 distance matrix. I noticed that setting the parameter k to larger numbers seriously increases the calculation time. Actually, with k=10 it

Re: [R] Hgu133acdf Installation Problem

2010-05-26 Thread Henrik Bengtsson
This is sounds like a Bioconductor related issue; please ask your question on the bioc mailing list. /Henrik On Wed, May 26, 2010 at 8:51 AM, mahalakshmi sivamani mahasiva1...@gmail.com wrote: Hi, While trying to install hgu133acdf- windows package in R im getting the following error and

Re: [R] writing function : can't find an object

2010-05-26 Thread Peter Ehlers
On 2010-05-26 1:17, arnaud Gaboury wrote: Dear group, Here is my function: #return the daily PL for day y PLDaily-function(x,y) { #find elements in my directory with LSCPos in the name, keep the numeric part in the name and #create a list l-gsub(\\D,,dir()[grep(LSCPos,dir())]) #select

Re: [R] writing function : can't find an object

2010-05-26 Thread Ivan Calandra
Hi, The first problem (I think) is your for loop: for (i in sel), what is sel?! Then you might want to write position[i] and trade[i] (I don't think that position and trade are functions, or they are in a package you don't specify). Depending on the class of position and trade, you might

Re: [R] Factor to Numeric

2010-05-26 Thread Ivan Calandra
Hi, What about: as.numeric(as.character(data$State)) ? Ivan Le 5/26/2010 09:32, Mohan L a écrit : Dear All, I have a data frame with State and 12 Months as column. I want to convert all the 12 month column from factor to numeric. any help will be greatly appreciated. str(data)

Re: [R] Get output values in a table

2010-05-26 Thread Iurie Malai
At a closer look I realized that this method is good for Shapiro-Wilk test, not for Two-samples Wilcoxon test. Can somebody to sugest a solution? I want to compare town with country. 2010/5/25 Iurie Malai iurie.ma...@gmail.com I use two similar scripts to put calculated values (many thanks for

Re: [R] More efficient way to use ifelse()?

2010-05-26 Thread Dennis Murphy
Hi: Look into switch(), something like elevation - switch(Population, 'CO' = 2169, 'CN' = 1121, ... ) HTH, Dennis On Tue, May 25, 2010 at 10:25

[R] Peak Over Threshold values

2010-05-26 Thread Tonja Krueger
Dear List I hope you can help me: I’ve got a dataframe (df) within which I am looking for Peak Over Threshold values as well as the length of the events. An event starts when walevel equals 5.8 and it should end when walevel equals the lower threshold value (5.35). I tried

Re: [R] Factor to Numeric

2010-05-26 Thread Mohan L
On Wed, May 26, 2010 at 1:13 PM, Ivan Calandra ivan.calan...@uni-hamburg.de wrote: Hi, What about: as.numeric(as.character(data$State)) ? What I what is, I want to convert all the column excluding State to factor to numeric in the data frame. So that I will send this data frame to

Re: [R] Avoiding Loops When Iterating Over Statement That Updates Its Input

2010-05-26 Thread Dennis Murphy
Hi: On Tue, May 25, 2010 at 11:43 PM, Alan Lue alan@gmail.com wrote: Since `for' loops are slow in R, and since `apply' functions are faster, I was wondering whether there were a way to use an apply function—or to otherwise avoid using a loop—when iterating over a statement that updates

[R] validation logistic regression

2010-05-26 Thread azam jaafari
Hi   I did validation for prediction by logistic regression according to following:   validationsize - 23 set.seed(1) random-runif(123) order(random) nrprofilesinsample-sort(order(random)[1:100]) profilesample - data[nrprofilesinsample,] profilevalidation - data[-nrprofilesinsample,]

Re: [R] Factor to Numeric

2010-05-26 Thread Ivan Calandra
What about (not tested because no sample data, and I'm definitely unsure of my lapply() solution): lapply(data[2:13], FUN=as.character) lapply(data[2:13], FUN=as.numeric) ? data[2:13] should correspond to the 12 Month columns. There might be a way to combine both lines but I don't think lapply

[R] substitution in a function

2010-05-26 Thread Meissner, Tony (DWLBC)
I have the following function defined as below match.trace - function(dfobj, distance, day1, day2) { day1 - substitute(dfobj$day1); day1 day2 - substitute(dfobj$day2) distance - substitute(dfobj$distance) xx - NULL for (i in 0:10) xx[i+1] - with(dfobj, cor(Lag((day1-day1[1]),i),

Re: [R] Peak Over Threshold values

2010-05-26 Thread Vito Muggeo (UniPa)
dear Tonja, By plotting your data plot(df) it seems to me that you are looking for a piecewise linear relationships. If this is the case, have a look to the package segmented. You have to specify or not the number and the starting values for the breakpoints library(segmented)

Re: [R] More efficient way to use ifelse()?

2010-05-26 Thread Duncan Murdoch
Ian Dworkin wrote: # This is more about trying to find a more effecient way to code some simple vectorized computations using ifelse(). # Say you have some vector representing a factor with a number of levels (6 in this case), representing the location that samples were collected. Population -

[R] Custom axis function in lattice:::xyplot

2010-05-26 Thread Gavin Simpson
Dear List, I have been writing a Lattice function to draw what we call stratigraphic diagrams, these are diagrams with a panel for each species showing a time series of abundance, but drawn vertically to represent time passing from bottom of plot towards to top. I am most of the way there with

Re: [R] summary of arima model in R

2010-05-26 Thread Joris Meys
I reckon you misunderstand the function arima. If you're interested in the significance of any regressor, you should use the proper fitting tools. Check all the code examples from the book I recommended before on : http://www.stat.pitt.edu/stoffer/tsa2/index.html There's a nice tutorial that

[R] lmer - how to test correlations?

2010-05-26 Thread René Mayer
Dear mixed modelers, If I have interactions between a categorical covariate and a random-effects grouping factor. How can I test formally the correlations? For example data(Machines, package = MEMSS) fm2aM - lmer(score ~ Machine + (0 + Machine|Worker), Machines) Random effects: Groups Name

[R] xlim/ylim and actual axis length

2010-05-26 Thread Peter Neuhaus
Dear plotting wizards, when plotting in R, the actual lengths of the axes are slightly greater than the ranges of the x/y variables or xlim/ylim values. how do I control the amount by which the axes are enlarged? Is there a way to enforce that the lengths of the axes equal xlim/ylim? example:

Re: [R] summary of arima model in R

2010-05-26 Thread David Scott
Joris Meys wrote: Check http://cran.r-project.org/doc/contrib/Ricci-refcard-ts.pdf for some ideas on testing time series in R. I'd go with the acf() and pacf() on the residuals of the arima model. If arima works, both plots will indicate absence of autocorrelation. also check ?tsdiag And if

[R] problem with not in in subseting dataframe

2010-05-26 Thread venkata kirankumar
Hi all, I have a problem while subsetting a dataframe that is while I am using *%in%* condition like *stemp-subset(temp, obj1 %in% obj2,select=c(temp))* this is working and giving results that what ever is there is both *obj1*and *obj2* ** ** but I want to get values which is there in *obj1*

Re: [R] More efficient way to use ifelse()?

2010-05-26 Thread Duncan Murdoch
Duncan Murdoch wrote: Ian Dworkin wrote: # This is more about trying to find a more effecient way to code some simple vectorized computations using ifelse(). # Say you have some vector representing a factor with a number of levels (6 in this case), representing the location that samples

Re: [R] xlim/ylim and actual axis length

2010-05-26 Thread Duncan Murdoch
Peter Neuhaus wrote: Dear plotting wizards, when plotting in R, the actual lengths of the axes are slightly greater than the ranges of the x/y variables or xlim/ylim values. how do I control the amount by which the axes are enlarged? Is there a way to enforce that the lengths of the axes equal

Re: [R] validation logistic regression

2010-05-26 Thread Joris Meys
Hi, first of all, you shouldn't backtransform your prediction, use the option type=response instead : salichpred-predict(salic.lr, newdata=profilevalidation,type=response) limit - 0.5 salichpredcat - ifelse(salichpredlimit,0,1) # prediction of categories. Read in on sensitivity, specificity

Re: [R] xlim/ylim and actual axis length

2010-05-26 Thread Jim Lemon
On 05/26/2010 09:49 PM, Peter Neuhaus wrote: Dear plotting wizards, when plotting in R, the actual lengths of the axes are slightly greater than the ranges of the x/y variables or xlim/ylim values. how do I control the amount by which the axes are enlarged? Is there a way to enforce that the

Re: [R] problem with not in in subseting dataframe

2010-05-26 Thread jim holtman
try: stemp-subset(temp, !(obj1 %in% obj2),select=c(temp)) On Wed, May 26, 2010 at 7:57 AM, venkata kirankumar kiran4u2...@gmail.com wrote: Hi all, I have a problem while subsetting a dataframe that is while I am using  *%in%* condition like *stemp-subset(temp, obj1 %in%

Re: [R] Factor to Numeric

2010-05-26 Thread David Winsemius
On May 26, 2010, at 4:05 AM, Ivan Calandra wrote: What about (not tested because no sample data, and I'm definitely unsure of my lapply() solution): lapply(data[2:13], FUN=as.character) lapply(data[2:13], FUN=as.numeric) ? That would not preserve any of the output since no assignments

Re: [R] Calculation time of isoMDS and the optimal number of dimensions

2010-05-26 Thread Joris Meys
Hi Michael, thanks for your answer. Indeed, with a 100x100 matrix it runs even pretty fast with k=30. But as with a lot of things in R, there is a disproportionate rise in the calculation time once you exceed a certain size limit on your matrices. In the end, it ran about 8 hours for my complete

Re: [R] xlim/ylim and actual axis length

2010-05-26 Thread Peter Neuhaus
Quoting Duncan Murdoch murdoch.dun...@gmail.com: If you use xaxs=i in your call, the axes won't be extended. If you want them extended by something other than the default amount, you should probably use both xaxs=i and xlim=... for fine control. perfect! Thank you very much. Peter

Re: [R] validation logistic regression

2010-05-26 Thread Frank E Harrell Jr
On 05/26/2010 07:00 AM, Joris Meys wrote: Hi, first of all, you shouldn't backtransform your prediction, use the option type=response instead : salichpred-predict(salic.lr, newdata=profilevalidation,type=response) limit- 0.5 salichpredcat- ifelse(salichpredlimit,0,1) # prediction of

Re: [R] Calculation time of isoMDS and the optimal number of dimensions

2010-05-26 Thread Joris Meys
Hi Gavin, thank you for the answer. I am aware of the fact that with nMDS it's about the configuration, and that's exactly my problem: the configuration changes pretty much when I increase the number of dimensions. As I am trying to go from a CAT(0) space of trees (see Billera et al on geodesic

[R] (no subject)

2010-05-26 Thread arnaud Gaboury
Dear group, Here is my data frame: dput(u) structure(list(DESCRIPTION = structure(c(2L, 5L, 6L, 7L, 9L, 11L, 12L, 15L, 14L, 16L, 1L, 10L, 3L, 4L, 13L, 8L, 17L), .Label = c(COFFEE C Jul/10, COPPER May/10, CORN Jul/10, CORN May/10, COTTON NO.2 Jul/10, CRUDE OIL miNY May/10, GOLD Jun/10, HENRY

[R] condition apply to elements of a data frame column

2010-05-26 Thread arnaud Gaboury
Oops, forgot to give a subject -Original Message- From: arnaud Gaboury [mailto:arnaud.gabo...@gmail.com] Sent: Wednesday, May 26, 2010 2:31 PM To: r-help@r-project.org Cc: 'arnaud Gaboury' Subject: Dear group, Here is my data frame: dput(u) structure(list(DESCRIPTION =

Re: [R] (no subject)

2010-05-26 Thread Henrique Dallazuanna
Try this: ifelse(!u$POSITION, 'Positions are wrong', '') On Wed, May 26, 2010 at 9:31 AM, arnaud Gaboury arnaud.gabo...@gmail.comwrote: Dear group, Here is my data frame: dput(u) structure(list(DESCRIPTION = structure(c(2L, 5L, 6L, 7L, 9L, 11L, 12L, 15L, 14L, 16L, 1L, 10L, 3L, 4L, 13L,

Re: [R] (no subject)

2010-05-26 Thread Joris Meys
What exactly are you trying to do? If you want to know which position is wrong, try : if (sum(u$POSITION==0)0) cat(WARNING:POSITION IS WRONG FOR ,which(u$POSITION==0),\n) or even : wrong - which(u$POSITION==0) if(length(wrong)0) cat(WARNING: POSITION IS WRONG FOR,u$DESCRIPTION[wrong],\n) Gives

Re: [R] More efficient way to use ifelse()?

2010-05-26 Thread Jorge Ivan Velez
Hi Ian. Take a look at the recode function in the car package. HTH, Jorge On Wed, May 26, 2010 at 1:25 AM, Ian Dworkin wrote: # This is more about trying to find a more effecient way to code some simple vectorized computations using ifelse(). # Say you have some vector representing a

Re: [R] (no subject)

2010-05-26 Thread Henrique Dallazuanna
So: ifelse(any(!u$POSITION), 'Positions are wrong', '') On Wed, May 26, 2010 at 9:47 AM, arnaud Gaboury arnaud.gabo...@gmail.comwrote: ifelse(!u$POSITION, 'Positions are wrong', '') [1]

Re: [R] Calculation time of isoMDS and the optimal number of dimensions

2010-05-26 Thread Gavin Simpson
On Wed, 2010-05-26 at 14:25 +0200, Joris Meys wrote: Hi Gavin, thank you for the answer. I am aware of the fact that with nMDS it's about the configuration, and that's exactly my problem: the configuration changes pretty much when I increase the number of dimensions. As I am trying to go

Re: [R] validation logistic regression

2010-05-26 Thread azam jaafari
Hi   Thank you for your reply.   I'm new in R. So I'm slow   If I want to do leave-one-out cross validation with these data(100), how I tell R that omit one by one data? Is validationsize=100?    Thanks alot   Azam   --- On Wed, 5/26/10, Joris Meys jorism...@gmail.com wrote: From: Joris Meys

Re: [R] validation logistic regression

2010-05-26 Thread Frank E Harrell Jr
Better would be 100 repeats of 10-fold cross-validation, or bootstrapping, as implemented in the rms package. Frank On 05/26/2010 08:21 AM, azam jaafari wrote: Hi Thank you for your reply. I'm new in R. So I'm slow If I want to do leave-one-out cross validation with these data(100), how I

Re: [R] Relative Risk/Hazard Ratio plots for continuous variables

2010-05-26 Thread Terry Therneau
I prefer smoothing splines, Frank prefers regression splines. The former is built into the survival package: options(na.action=na.exclude) # This should be the default IMHO coxfit1- coxph(Surv(rtime,rcens) ~ pspline(cts), data=data1) summary(coxfit1) #shows the linear and nonlinear tests

[R] extracat , JGR, iWidgets install problems

2010-05-26 Thread Michael Friendly
[Environment: Win XP, R 2.10.1] I'm trying to install the packages JGR and iWidgets required by the extracat package to make the interactive plots in the package work. I've tried various things, but nothing seems to work. Here is my most recent attempt, followed by my sessionInfo(). Does

Re: [R] condition apply to elements of a data frame column

2010-05-26 Thread Joris Meys
Arnaud, check the vector : u$POSITION0 [1] TRUE TRUE ... what I do is putting u$POSITION==0 [1] FALSE FALSE ... when you apply the sum() function on that vector, FALSE becomes 0 and TRUE becomes 1. So this actually gives you a way of counting the amount of positions that are not zero. if you

Re: [R] Lattice: relation = 'free' in scales

2010-05-26 Thread Deepayan Sarkar
On Tue, May 25, 2010 at 9:30 PM, Peter Ehlers ehl...@ucalgary.ca wrote: Albart, On 2010-05-25 1:51, Albart wrote: Hello list, I am making graphics for an article which I want to publish. The article is about several methods (to calculate breeding values of individuals) applied in

[R] Socket establishment

2010-05-26 Thread wesley mathew
Dear All I have some doubt about socket establishment. I am sending this question again. Sorry to bothering you a lot. Example : make.socket(host = localhost, port=9754, fail = TRUE, server = FALSE) *Error in make.socket(host = localhost, port = 9754, fail = TRUE, server = FALSE) : socket not

[R] stress function in isoMDS

2010-05-26 Thread Joris Meys
Dear all, as far as my understanding goes, isoMDS uses the Kruskal definition of stress, i.e. : the square root of the ratio of the sum of squared differences between the input distances and those of the configuration to the sum of configuration distances squared. (as stated in the help files).

Re: [R] Socket establishment

2010-05-26 Thread Allan Engelhardt
Presumably nothing is accepting connections on port 9754. Unless you've got a server listening for connections there, then this is the expected behaviour. (If you wanted to write a server then, obviously, use server=TRUE.) If there is a server, then it is probably not working. Very

Re: [R] More efficient way to use ifelse()?

2010-05-26 Thread David Winsemius
On May 26, 2010, at 1:25 AM, Ian Dworkin wrote: # This is more about trying to find a more effecient way to code some simple vectorized computations using ifelse(). # Say you have some vector representing a factor with a number of levels (6 in this case), representing the location that

[R] Fill a matrix using logical arguments?

2010-05-26 Thread Alistair Auffret
Hello all, I am going slightly mad trying to create a table for running co-correspondence analysis. What I have is seed bank and vegetation data, and my aim is to see if the vegetation found in a site (containing several seed bank samples) can predict the composition of a seed bank sample

Re: [R] Hierarchical clustering using own distance matrices

2010-05-26 Thread new...@r
new...@r wrote: Hey Everyone! I wanted to carry out Hierarchical clustering using distance matrices i have calculated ( instead of euclidean distance etc.) I understand as.dist is the function for this, but the distances in the dendrogram i got by using the following script(1) were

[R] error variable names are limited to 256 bytes when sourcing code

2010-05-26 Thread Brian Frizzelle
I've written a function that takes some input data output from a simulation model and creates some graphs. It's not very complicated code, and it works perfectly fine if I just run the code as is. But I have converted it into a function so we call it externally, and when I try to source the

[R] Autocorrelation in R for NLS

2010-05-26 Thread ruchita gupta
Hello Can someone please let me know how to test for Autocorrelation in R ( eg. like durbin-watson statistic or any other test) after performing Non linear least squares and what can be the best solution for it. Thanks Regards Ruchita [[alternative HTML version deleted]]

[R] Survival analysis extrapolation

2010-05-26 Thread TReason
Dear all, I'm trying to fit a curve to some 1 year failure-time data, so that I can extrapolate and predict failure rates up to 3 years. The data is in the general form: Treatment Time Status Treatment A28 0

Re: [R] condition apply to elements of a data frame column

2010-05-26 Thread arnaud Gaboury
Joris, I want to add a line in a function with a print warning if one element of the column is 0. I could use if(sum(u$POSITION)0) as a condition, but I can imagine having one element equal to -2, and another one to 2. So in this case, sum=0, but the condition is false in fact (minimum of one

[R] cluster analysis and supervised classification: an alternative to knn1?

2010-05-26 Thread abanero
Hi, I have a 1.000 observations with 10 attributes (of different types: numeric, dicotomic, categorical ecc..) and a measure M. I need to cluster these observations in order to assign a new observation (with the same 10 attributes but not the measure) to a cluster. I want to calculate for

Re: [R] Code to calculate internal rate of return

2010-05-26 Thread Dimitri Shvorob
Unfortunately, this is not a robust implementation, and is derailed by Error in uniroot(f, c(-1, 1)) : f() values at end points not of opposite sign -- View this message in context: http://r.789695.n4.nabble.com/Code-to-calculate-internal-rate-of-return-tp864645p2231910.html Sent from the R

[R] how to avoid a subset of a matrix to become a column vector

2010-05-26 Thread mauede
I am assigning subset of a matrix A [n,3] where n1 to a temporary matrix TMP I do not know how many rows of A will be assigned to TMP because this is established by a run-time test. I expect TMP to be a matrix [m,3], m =1 But when 1 row only is transferred from A to TMP then TMP becomes [3,1]

[R] Problem with plotting survival predictions from cph model

2010-05-26 Thread Michal Figurski
Dear R-helpers, I am working with 'cph' models from 'rms' library. When I build simple survival models, based on 'Surv(time, event)', everything is fine and I can make nice plots using plot(Predict(f, time=3)). However, recently I tried to be more specific and used 'Surv(start, stop,

Re: [R] how to avoid a subset of a matrix to become a column vector

2010-05-26 Thread David Winsemius
On May 26, 2010, at 11:58 AM, mau...@alice.it mau...@alice.it wrote: I am assigning subset of a matrix A [n,3] where n1 to a temporary matrix TMP I do not know how many rows of A will be assigned to TMP because this is established by a run-time test. I expect TMP to be a matrix [m,3], m

Re: [R] cluster analysis and supervised classification: an alternative to knn1?

2010-05-26 Thread Joris Meys
Not a direct answer, but from your description it looks like you are better of with supervised classification algorithms instead of unsupervised clustering. see the library randomForest for example. Alternatively, you can try a logistic regression or a multinomial regression approach, but these

Re: [R] how to avoid a subset of a matrix to become a column vector

2010-05-26 Thread Joris Meys
What exactly are you trying to do? An example (which you should have provided) A - matrix(1:100,nrow=10,ncol=10) B - A[10,1:3] B [1] 10 20 30 is.matrix(B) [1] FALSE matrix(B) [,1] [1,] 10 [2,] 20 [3,] 30 This is logic, as you convert a vector to a matrix, and he will assume

[R] how to Store loop output from a function

2010-05-26 Thread Changbin Du
HI, Dear R community, I am writing the following function to create one data set(*tree.pred*) and one vector(*valid.out*) from loops. Later, I want to use the data set from this loop to plot curves. I have tried return, list, but I can not use the *tree.pred* data and *valid.out* vector.

Re: [R] how to Store loop output from a function

2010-05-26 Thread Joshua Wiley
If you use return you need to assign the results to an object. For instance tree.pred - yourfunction then tree.pred will contain whatever data you returned from your function. If you truly want your function to assign objects internally that are available in your general workspace, instead of

[R] rjags installation problem in Ubuntu 10.04

2010-05-26 Thread Scott Brogan
I've not been able to install rjags successfully in Ubuntu 10.04 : ** testing if installed package can be loaded Error : .onLoad failed in loadNamespace() for 'rjags', details: call: dyn.load(file, DLLpath = DLLpath, ...) error: unable to load shared library

Re: [R] how to Store loop output from a function

2010-05-26 Thread Changbin Du
tree.pred - yourfunction works! Thanks, Josh! On Wed, May 26, 2010 at 9:35 AM, Joshua Wiley jwiley.ps...@gmail.comwrote: If you use return you need to assign the results to an object. For instance tree.pred - yourfunction then tree.pred will contain whatever data you returned from

Re: [R] Custom axis function in lattice:::xyplot

2010-05-26 Thread Peter Ehlers
On 2010-05-26 4:03, Gavin Simpson wrote: Dear List, I have been writing a Lattice function to draw what we call stratigraphic diagrams, these are diagrams with a panel for each species showing a time series of abundance, but drawn vertically to represent time passing from bottom of plot towards

[R] data frame manipulation change elements meeting criteria

2010-05-26 Thread arnaud Gaboury
Dear group, Here is my df : trade - structure(list(Trade.Status = c(DEL, INS, INS), Instrument.Long.Name = c(SUGAR NO.11, CORN, CORN), Delivery.Prompt.Date = c(Jul/10, Jul/10, Jul/10), Buy.Sell..Cleared. = c(Sell, Buy, Buy), Volume = c(1L, 2L, 1L), Price = c(15.2500, 368., 368.5000),

Re: [R] Custom axis function in lattice:::xyplot

2010-05-26 Thread Deepayan Sarkar
On Wed, May 26, 2010 at 10:20 AM, Peter Ehlers ehl...@ucalgary.ca wrote: On 2010-05-26 4:03, Gavin Simpson wrote: Dear List, I have been writing a Lattice function to draw what we call stratigraphic diagrams, these are diagrams with a panel for each species showing a time series of

Re: [R] Custom axis function in lattice:::xyplot

2010-05-26 Thread Gavin Simpson
snip / # There must a better way, but this works; add labels = levels(dat$fac)[panel.number()], # to your panel.axis() call in axis.VarLabs. Thanks Peter. I had tried that but it didn't work. Now just realised I was hitting a scoping problem and that my example was subtly different to

Re: [R] Problem with plotting survival predictions from cph model

2010-05-26 Thread Frank E Harrell Jr
On 05/26/2010 10:55 AM, Michal Figurski wrote: Dear R-helpers, I am working with 'cph' models from 'rms' library. When I build simple survival models, based on 'Surv(time, event)', everything is fine and I can make nice plots using plot(Predict(f, time=3)). However, recently I tried to be more

[R] Linear Discriminant Analysis in R

2010-05-26 Thread cobbler_squad
Dear R gurus, Thank you all for continuous support and guidance -- learning without you would not be efficient. I have a question regarding LD analysis and how to best code it up in R. I have a file of (V52 and 671 time points across all columns) and another file of phonetic features (each

[R] counts of a vector

2010-05-26 Thread speretti
Hi, I need help to find an efficient way to transform a vector like: a-c(1,1,0,1,0,0,0,1,1,1,1,0,1,0,1,1) in a vector that counts only di 1 elements, like: b-c(1,2,0,1,0,0,0,1,2,3,4,0,1,0,1,2) Thank you! -- View this message in context:

Re: [R] error variable names are limited to 256 bytes when sourcing code

2010-05-26 Thread Wu Gong
I can only repeat your error message :) n256 - paste(rep(A,256),collapse=) assign(n256, 1) n257 - paste(rep(A,257),collapse=) assign(n257, 1) Error in assign(n257, 1) : variable names are limited to 256 bytes - A R learner. -- View this message in context:

Re: [R] counts of a vector

2010-05-26 Thread Erik Iverson
speretti wrote: Hi, I need help to find an efficient way to transform a vector like: a-c(1,1,0,1,0,0,0,1,1,1,1,0,1,0,1,1) in a vector that counts only di 1 elements, like: b-c(1,2,0,1,0,0,0,1,2,3,4,0,1,0,1,2) Thank you! One way: rl - rle(a) unlist(mapply(*, lapply(rl$lengths,

Re: [R] counts of a vector

2010-05-26 Thread Gabor Grothendieck
Check out this thread for numerous solutions: https://stat.ethz.ch/pipermail/r-help/2007-June/134557.html On Wed, May 26, 2010 at 1:22 PM, speretti sabrina.pere...@gmail.com wrote: Hi, I need help to find an efficient way to transform a vector like: a-c(1,1,0,1,0,0,0,1,1,1,1,0,1,0,1,1) in

[R] R/Rmetrics Meielisalp Summer School and User/Developer Workshop 2010

2010-05-26 Thread Diethelm Wuertz
Computational Finance and Financial Engineering 1st R/Rmetrics Summer School and 4th User/Developer Meeting Meielisalp, Lake Thune Switzerland, June 27 - July 1, 2010 Late Registration: https://www.rmetrics.org/meielisalp2010-registration Students: Apply for Student Scholarships

Re: [R] error variable names are limited to 256 bytes when sourcing code

2010-05-26 Thread Barry Rowlingson
On Wed, May 26, 2010 at 6:00 PM, Wu Gong gho...@gmail.com wrote: I can only repeat your error message :) n256 - paste(rep(A,256),collapse=) assign(n256, 1) n257 - paste(rep(A,257),collapse=) assign(n257, 1) Error in assign(n257, 1) : variable names are limited to 256 bytes If a

Re: [R] Peak Over Threshold values

2010-05-26 Thread Clint Bowman
How about? hi.rle-rle(walevel5.79) lo.rle-rle(walevel5.36) plot(walevel) abline(h=5.8,col=2,lty=3) abline(h=5.35,col=3,lty=3) hi.lo.rle-sort(c(cumsum(hi.rle$lengths),cumsum(lo.rle$lengths))) abline(v=hi.lo.rle) You can use the $values from the rle to sort things out. Probably want to ignore

Re: [R] error quot;variable names are limited to 256 b ytesquot; when sourcing code

2010-05-26 Thread Ben Bolker
Barry Rowlingson b.rowlingson at lancaster.ac.uk writes: If a variable name can have 26 upper case + 26 lower case + 10 numbers then the number of possible variable names is: 711659926691456588820198688981513283237719214167524272940980007340737850\

Re: [R] error variable names are limited to 256 bytes when sou

2010-05-26 Thread Ted Harding
On 26-May-10 18:40:46, Barry Rowlingson wrote: On Wed, May 26, 2010 at 6:00 PM, Wu Gong gho...@gmail.com wrote: I can only repeat your error message :) n256 - paste(rep(A,256),collapse=) assign(n256, 1) n257 - paste(rep(A,257),collapse=) assign(n257, 1) Error in assign(n257, 1) : variable

Re: [R] data frame manipulation change elements meeting criteria

2010-05-26 Thread Joris Meys
see ?switch X- rep(c(Buy,Sell,something else),each=5) Y- rep(c(DEL,INS,DEL),5) new.vect - X for (i in which(Y==DEL)){ new.vect[i]-switch( EXPR = X[i], Sell=Buy, Buy=Sell, X[i]) } cbind(new.vect,X,Y) On Wed, May 26, 2010 at 7:43 PM, arnaud Gaboury

Re: [R] error variable names are limited to 256 bytes when sourcing code

2010-05-26 Thread Brian Frizzelle
All, I think there may be some misunderstanding about my problem. In my code, which is written as an R function, all of my variable names are short. I get that error when I try to source the function so I can call it. I just do not know why I'm getting the error, especially since I have written

Re: [R] counts of a vector

2010-05-26 Thread William Dunlap
Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of speretti Sent: Wednesday, May 26, 2010 10:22 AM To: r-help@r-project.org Subject: [R] counts of a vector Hi, I

Re: [R] error variable names are limited to 256 bytes when sourcing code

2010-05-26 Thread Erik Iverson
Is the '`' character supposed to be there before the ## Add error bars comment? If that is the problem, let it be a good lessonto use an editor with syntax highlighting. :) Brian Frizzelle wrote: All, I think there may be some misunderstanding about my problem. In my code, which

Re: [R] error variable names are limited to 256 bytes when sourcing code

2010-05-26 Thread Joris Meys
I was about to say the same. loading the code line per line gave the error a few lines after that one. Which explains... Cheers Joris On Wed, May 26, 2010 at 9:27 PM, Erik Iverson er...@ccbr.umn.edu wrote: Is the '`' character supposed to be there before the ## Add error bars comment? If

Re: [R] Getting sink to work with message on R 2.11.0 - what didI miss?

2010-05-26 Thread Greg Snow
Inline below: From: Tal Galili [mailto:tal.gal...@gmail.com] Sent: Wednesday, May 26, 2010 12:26 AM To: Greg Snow Cc: Faiz Rasool; R-help@r-project.org Subject: Re: [R] Getting sink to work with message on R 2.11.0 - what didI miss? Hello Greg, Thank you for the coding. A few

[R] R editor

2010-05-26 Thread bgf
Erik, What R editor do you use? I've tried SciTE but it won't color the code. Brian __ 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

Re: [R] error variable names are limited to 256 bytes when sourcing code

2010-05-26 Thread Brian Frizzelle
Well, that's embarrassing. Thank you for finding that. -- View this message in context: http://r.789695.n4.nabble.com/error-variable-names-are-limited-to-256-bytes-when-sourcing-code-tp2231800p2232244.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] R editor

2010-05-26 Thread Joris Meys
I'm not Erik, but what the heck. What platform, linux or Windows? On Windows, I use Tinn-R, which is great for using with R as you get full control over the console. You need to take into account that you should install R with the SDI option, and that you have to configure Tinn-R the first time

Re: [R] Kalman Filter

2010-05-26 Thread Giovanni Petris
To find out what tools are available in R, you can check out the Time Series task view on CRAN: http://cran.r-project.org/web/views/TimeSeries.html My personal preference is for package dlm, but here I am probably biased. [discaimer: the following is a sponsored link] For more information on

Re: [R] R editor

2010-05-26 Thread Erik Iverson
Joris' suggestions are good ones. I use Emacs with ESS (and now org-babel) for R programming and for interaction with the R process. But I use Emacs for everything. Emacs is actually pretty easy to install these days on Windows, and Vincent Goulet provides a nice package with all you need to

[R] Is possible a mini-plot into a big plot with Lattice?

2010-05-26 Thread Walmes Marques Zeviani
Hello, I want to do with Lattice functions (qqmath, histogram) a figure like this below. n - 1000 x - rnorm(n) qqnorm(x); qqline(x) op - par(fig=c(.02,.5,.5,.98), new=TRUE) hist(x, xlab=, ylab=, main=, axes=FALSE) box() par(op) Is possible? Thanks. Walmes Zeviani.

  1   2   >