[R] Help with functions as arguments

2013-02-11 Thread Ian Renner
Hi, I am trying to write a function which defines some arguments, then uses those arguments as arguments of other function calls. It's a bit tricky to explain, so a simple example will have to suffice. I imagine this has a simple solution, but perusing through environments and other help lists

[R] Inserting rows of interpolated data

2013-02-11 Thread Benstead, Jonathan
Dear help list - I have light data with 5-min time-stamps. I would like to insert four 1-min time-stamps between each row and interpolate the light data on each new row. To do this I have come up with the following code: lightdata <- read.table("Test_light_data.csv", header = TRUE, sep = ",") #

[R] Changing the order of months within a year

2013-02-11 Thread nick pardikes
I have data that looks like below and I would like to re-order the values within the "date" column. I would like to have each year organized like so: Sep-71 Oct-71 Nov-71 Dec-71 Jan-71 Feb-71 Mar-71 Apr-71 May-71 Jun-71 Jul-71 Aug-71 Sep-72 Oct-72 etc... Is there any way I can order the column i

Re: [R] Deques in R

2013-02-11 Thread Michael Holt
Thanks. I'm more familiar with Java than I am C++ so that might be worth checking out. I also found this code with looks like it could do what I need: http://finzi.psych.upenn.edu/R/Rhelp02/archive/15541.html I've read some things about possible issues with it but it might work for my use case.

Re: [R] improving/speeding up a very large, slow simulation

2013-02-11 Thread Joshua Wiley
Hi Ben, I appreciate that the example is reproducible, and I understand why you shared the entire project. At the same time, that is an awful lot of code for volunteers to go through and try to optimize. I would try to think of the structure of your task, see what the individual pieces are---fig

Re: [R] improving/speeding up a very large, slow simulation

2013-02-11 Thread Anindya Sankar Dey
Hi, I've just read your intro, not the full code. But one way first divide your input data into parts and make a list where each element of the list is one part of your input data. Rest of code put in a function, which will work on a part of your data. Build the function such that it takes list as

[R] improving/speeding up a very large, slow simulation

2013-02-11 Thread Benjamin Caldwell
Dear R help; I'll preface this by saying that the example I've provided below is pretty long, turgid, and otherwise a deep dive into a series of functions I wrote for a simulation study. It is, however, reproducible and self-contained. I'm trying to do my first simulation study that's quite big,

[R] How do I solve a disk I/O error with RSQLite?

2013-02-11 Thread chen jia
Hi there, I had an error when using RSQLite. My code and the error message are the following: > dbGetQuery(sql.dispersion, +"create table monthly_data_temp as + select a.*, b.industry + from monthly_data as a left join +siccd_industry_ff49

[R] how to change whisker width in bwplot (lattice)

2013-02-11 Thread Elaine Kuo
Hello, I am using lattice to draw boxplots. I would like to make the whisker look shorter than the box width. Please kindly advise how to modify the code. Thank you. Elaine code bwplot(x,y, pch=rep("|",2), box.umbrella = list(col = "black", lty = 1)) [[alternative HTML version deleted]

Re: [R] Clean up biplot resulting from princomp()

2013-02-11 Thread mtb954
Thanks David. ?biplot is not exactly verbose on the issue, but in hindsight I can see how I might have figured that out on my own. In any case, I appreciate the time you took to show me how to do that. Best wishes, Mark Na On Mon, Feb 11, 2013 at 2:56 PM, David L Carlson wrote: > ?biplot > > s

Re: [R] how to make a median line thicker in bwplot (lattice)

2013-02-11 Thread Duncan Mackay
Hi I had a similar problem - see http://tolstoy.newcastle.edu.au/R/e9/help/10/03/7129.html DF <- data.frame(site = factor(rep(1:5, each = 20)), height = rnorm(100)) bwplot(height~ site,DF, pch = "|", panel = function(x, y, ..., horizontal) {

Re: [R] FORMAT EDITING

2013-02-11 Thread eliza botto
Dear Macqueen,Although this question might be out of context, but just for clarification of my own, i got fortran codes from my colleague who is using MAC OS. Whereas, i am using XP and windows 7 with CVF 6.6. The codes run efficiently on his system but for me it prompts up with an error that

Re: [R] Deques in R

2013-02-11 Thread Barry Rowlingson
On Mon, Feb 11, 2013 at 9:42 PM, Barry Rowlingson wrote: > but I can't find it on CRAN now... > > http://cran.r-project.org/web/packages/Containers/ > > so you could hook the code out of the archives and find out if it still > works... I just looked at the DESCRIPTION and it depends on rJava,

Re: [R] Deques in R

2013-02-11 Thread Barry Rowlingson
On Mon, Feb 11, 2013 at 5:20 PM, Michael Holt wrote: > I've been searching for information on using deques in R for the past couple > of days. What little I've found has pointed me towards either the Rcpp > package or the cpp project on R-forge > (https://r-forge.r-project.org/projects/cpp/), b

Re: [R] FORMAT EDITING

2013-02-11 Thread MacQueen, Don
You say, "Š use the R output file in Fortran Š " I guess that means that R is writing an output file which will then be used as an input file for a fortran program. In that case, you need to go back to how R is writing the output file, find out why it is writing blank lines, and correct it. As far

Re: [R] Putting an array from excel into R Studio

2013-02-11 Thread Gene Leynes
This doesn't answer your question, but you may find some of my functions useful: https://github.com/geneorama/geneorama/blob/master/R/clipper.R https://github.com/geneorama/geneorama/blob/master/R/clipped.R You can quickly get stuff from Excel using the clipboard using clipped(). I also added so

Re: [R] Running a R file at a specific time each day

2013-02-11 Thread MacQueen, Don
cron does work just fine on the Mac, and will work the same way as in Linux, except (almost certainly) for the path to R itself. -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 2/11/13 11:16 AM, "Bhupendrasinh Thakre" wrote

Re: [R] Clean up biplot resulting from princomp()

2013-02-11 Thread David L Carlson
?biplot set.seed(42) pcout <- princomp(matrix(rnorm(1000), 100, 10)) biplot(pcout) biplot(pcout, xlabs=rep(".", dim(pcout$scores)[1])) # small symbol biplot(pcout, xlabs=rep("", dim(pcout$scores)[1])) # no symbol -- David L Carlson Associate Professor o

[R] Clean up biplot resulting from princomp()

2013-02-11 Thread mtb954
Dear R-helpers, The vectors in my biplot are completely obscured by the ~1400 labels R is printing on my biplot. I don't really care about the labels. How can I make the biplot without the annoying labels? See attached, if that helps you see my problem. Many thanks, Mark Na

Re: [R] Running a R file at a specific time each day

2013-02-11 Thread Bhupendrasinh Thakre
Depends on system you are working. Mac : Automator Windows : save the script in the folder where python is installed and then run it through command prompt. Linux and unix specific : cron jobs. As Mac is unix underneath so cron will work there also but never tried it. Best Regards, Bhupendras

[R] Deques in R

2013-02-11 Thread Michael Holt
I've been searching for information on using deques in R for the past couple of days. What little I've found has pointed me towards either the Rcpp package or the cpp project on R-forge (https://r-forge.r-project.org/projects/cpp/), but I've had trouble finding working examples. Are these the be

Re: [R] FORMAT EDITING

2013-02-11 Thread arun
Hi Elisa, It seems also that there are spaces between the second '.' and the number (1901.11. 1). You could do something like: Lines1<-readLines(textConnection("1901.11. 1 447.000    1901.11. 2 445.000    1901.11. 3 445.000    1924.11. 4 445.000    1924.11. 5 449.000    1924.11. 6 442.000

Re: [R] Running a R file at a specific time each day

2013-02-11 Thread Whit Armstrong
man cron or something more robust: http://jenkins-ci.org/ -Whit On Mon, Feb 11, 2013 at 1:51 PM, Christofer Bogaso wrote: > Hello again, > > My query may look quite generic, however at this point of time I just > want explain my problem. I am hopeful that somebody can help me. > > Let say I ha

[R] Running a R file at a specific time each day

2013-02-11 Thread Christofer Bogaso
Hello again, My query may look quite generic, however at this point of time I just want explain my problem. I am hopeful that somebody can help me. Let say I have a script file 'Script.R'. Now I want R to run this script file each day at a specific time, and store the result (the calculation for

[R] Putting an array from excel into R Studio

2013-02-11 Thread Nick Duncan
Dear All, I have been using RExcel for some time and find two features especially useful: i) The ability to select part of a worksheet and put it into R ii) The way of viewing the code, the output and the alerts in separate panes. The rest of R Excel I don't really use. The major benefit for me i

Re: [R] vegdist Error en double(N * (N - 1)/2) : tama?o del vector especificado es muy grande

2013-02-11 Thread Carolina Bello
Brian thanks for answer me, The idea is to make a hierarchical cluster of 138037 pixels of 1 km^2 from a study area of colombian Andes as a biogeographical regionalization . I have distributions models for 89 species so i have a matrix with the pixels in the rows and is full with absence(0)/pre

Re: [R] effect() error: non-conformable arguments

2013-02-11 Thread Elisha Sigmon
Sorry about that. Attached is the relevant data and the following is the code and error. >Help<-read.csv("R-help-effect.csv", sep=",", header=T) >Help$WeeksOut<-as.factor(Help$WeeksOut) >Help$Run<-as.factor(Help$Run) >GLM<-glm(NumberSpecies~Treatment*WeeksOut+Run+Tree., family=poisson (link=log),

Re: [R] getTree visualization (randomForest)

2013-02-11 Thread Umang Rathi
Hi, I would like to visualize a tree extracted from a random forest using getTree {randomForest}. I'm wondering if there is any way to do it directly or to convert my tree to any other class of tree repesentation, which then can be plotted? Regards, Umang Rathi

[R] Error in R (ENFA) : Error in eigen(Se) : infinite or missing values in 'x'

2013-02-11 Thread Leandro Abade
Dear all, I am running an Ecological Niche Factor Analysis in R but I am stuck with a problem. As soon as I ask the software to compute the ENFA, I get the following error message: Error in eigen(Se) : infinite or missing values in 'x' Does anyone know what could be wrong. I do not have missing

[R] FORMAT EDITING

2013-02-11 Thread eliza botto
Dear R users,[IF THE FORMAT OF MY EMAIL IS NOT CLEAR, I HAVE ATTACHED A TEXT FILE FOR A CLEAR VIEW] I would like to use the R output file in Fortran. my file Is exactly in the following format. ELISA/BOTTO wATER INN FROM 1900 11 1 TO 1996 12 31 1901.11. 1 447.000 1901.11. 2

Re: [R] Count of Histogram Bins using Shingles with lattice

2013-02-11 Thread David L Carlson
To get the counts in a variable: > library(lattice) > set.seed(42) > vals <- runif(100)*100 > ints <- co.intervals(vals, number=5, overlap=.25) > shgl <- shingle(vals, ints) > summary(shgl) Intervals: min max count 1 0.02362834 25.5431425 2 20.76563596 47.4999725 3 39.8482

Re: [R] effect() error: non-conformable arguments

2013-02-11 Thread John Fox
Dear Elisha, It's amazing how informative posting a reproducible example can be: The problem is that your model has aliased coefficients, and effect() can't handle that. Coincidentally, the development version of the effects package on R-Forge *can* handle models with aliased coefficients, so y

Re: [R] Count of Histogram Bins using Shingles with lattice

2013-02-11 Thread David L Carlson
You can use the functions in lattice to compute the shingle and display the results, but they do not seem to be stored: > set.seed(42) > vals <- runif(100)*100 > ints <- co.intervals(vals, number=5, overlap=.25) > cts <- shingle(vals, ints) cts contains has the original data and the range of each

Re: [R] how to make a median line thicker in bwplot (lattice)

2013-02-11 Thread David Winsemius
On Feb 11, 2013, at 1:23 AM, Elaine Kuo wrote: Hello, I am drawing a boxplot using bwplot in lattice. I would like to learn how to draw a thicker median line instead of the default setting. Thank you. Code bwplot(, pch=rep("|",2)) At the moment panel.bwplot has code at the end

Re: [R] Avoid re-building a vignette

2013-02-11 Thread Uwe Ligges
On 11.02.2013 15:44, Terry Therneau wrote: I once knew the answer to this, but can't find where I found it. Say I have a vignette that I don't want R to automatically rebuild, perhaps it uses some data I can't share or takes too long to run or whatever. Say it is mypackage/vignettes/charlie.R

Re: [R] impossible to invert a spam-object, but possible when it's a matrix-object

2013-02-11 Thread Berend Hasselman
On 11-02-2013, at 15:00, "Camarda, Carlo Giovanni" wrote: > Dear Uwe, > > thanks for the response. > I knew my matrix was almost singular, but is there any way to implement the > algorithm is solve(base) with a spam-matrix? > > As workaround, I might add a ridge penalty: > >ApP <- A+10^

[R] Avoid re-building a vignette

2013-02-11 Thread Terry Therneau
I once knew the answer to this, but can't find where I found it. Say I have a vignette that I don't want R to automatically rebuild, perhaps it uses some data I can't share or takes too long to run or whatever. Say it is mypackage/vignettes/charlie.Rnw It can create the pdf from an R session

Re: [R] convert 12 time stamp to 24 hour

2013-02-11 Thread PIKAL Petr
Hi > -Original Message- > From: e-letter [mailto:inp...@gmail.com] > Sent: Monday, February 11, 2013 3:11 PM > To: PIKAL Petr > Cc: r-help@r-project.org > Subject: Re: [R] convert 12 time stamp to 24 hour > > On 11/02/2013, PIKAL Petr wrote: > > > > str(testtimedataset) > > With my real

Re: [R] Training with very few positives

2013-02-11 Thread Ben Bolker
James Jong gmail.com> writes: > > I have a binary classification problem where the fraction of positives is > very low, e.g. 20 positives in 10,000 examples (0.2%) > > What is an appropriate cross validation scheme for training a classifier > with very few positives? [snip] > ==

Re: [R] How to plot doubles series with different location using plotCI

2013-02-11 Thread linde
Thank you very much, indeed I have mixing up the "x" and "y" values. Best, Rosalinde   De : Jim Lemon Cc : "r-help@r-project.org" Envoyé le : Lundi 11 février 2013 11h41 Objet : Re: [R] How to plot doubles series with different location using plotCI

Re: [R] impossible to invert a spam-object, but possible when it's a matrix-object

2013-02-11 Thread Uwe Ligges
On 11.02.2013 15:00, Camarda, Carlo Giovanni wrote: Dear Uwe, thanks for the response. I knew my matrix was almost singular, but is there any way to implement the algorithm is solve(base) with a spam-matrix? Not sure, I think you want another threshold for the error. But I do not know if t

Re: [R] Constrained Optimization in R (alabama)

2013-02-11 Thread Ravi Varadhan
Berend, I had pointed out this solution to Axel already, but he aparently wants to solve more general problems like this, so he wanted a solution from constrained optimimzers. But, if the more general problems have the similarly discrete set of candidate parameter values, using constrained opti

Re: [R] convert 12 time stamp to 24 hour

2013-02-11 Thread e-letter
On 11/02/2013, PIKAL Petr wrote: > > str(testtimedataset) With my real data set, revealed that after conversion, the time series data consists of 'chr' which I guess means character type data, reporting the following error: Error in plot.window(...) : need finite 'xlim' values In addition: Warni

Re: [R] impossible to invert a spam-object, but possible when it's a matrix-object

2013-02-11 Thread Camarda, Carlo Giovanni
Dear Uwe, thanks for the response. I knew my matrix was almost singular, but is there any way to implement the algorithm is solve(base) with a spam-matrix? As workaround, I might add a ridge penalty: ApP <- A+10^-1*diag.spam(nrow(A)) solve(ApP) but this would completely jeopardize othe

Re: [R] convert 12 time stamp to 24 hour

2013-02-11 Thread PIKAL Petr
Hi > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of e-letter > Sent: Monday, February 11, 2013 2:31 PM > To: r-help@r-project.org > Subject: Re: [R] convert 12 time stamp to 24 hour > > Readers, > > Have since tried to plot c

Re: [R] convert 12 time stamp to 24 hour

2013-02-11 Thread Rui Barradas
Hello, You're trying to plot the df, not the column. Try plot(testdata ~ testtimedataset$V1) Hope this helps, Rui Barradas Em 11-02-2013 13:30, e-letter escreveu: Readers, Have since tried to plot converted 24 hour data: testtimedataset V1 1 13:01:41 2 13:02:10 3 13:02:38 4 13:03

Re: [R] convert 12 time stamp to 24 hour

2013-02-11 Thread e-letter
Readers, Have since tried to plot converted 24 hour data: testtimedataset V1 1 13:01:41 2 13:02:10 3 13:02:38 4 13:03:05 5 13:03259 > testdata<-seq(1:5) > plot(testdata~testtimedataset) Error in function (formula, data = NULL, subset = NULL, na.action = na.fail, : invalid type (list)

Re: [R] store variables in a for loop using get()

2013-02-11 Thread Duncan Murdoch
On 13-02-11 6:58 AM, ivan wrote: Dear R list, I have a problem in assigning values to existing data frames in R. I have a vector x containing the names of the data frames, which I create to store the results for each variable (a1,a2,a3) obtained in time series moving regressions. Thus, say, x=c

[R] store variables in a for loop using get()

2013-02-11 Thread ivan
Dear R list, I have a problem in assigning values to existing data frames in R. I have a vector x containing the names of the data frames, which I create to store the results for each variable (a1,a2,a3) obtained in time series moving regressions. Thus, say, x=c('a1','a2','a3') Moreover, b is a

Re: [R] help on plotting series with different x-axis values on a graph with one x-axis

2013-02-11 Thread Jim Lemon
On 02/09/2013 11:52 PM, Eike Marie Thaysen wrote: Hi, I have run into this problem a couple of times now and hope you can help! If I want to plot mulitiple series with differing x-axis values (however, all in the same range) in 1 plot with one common axis R obstruses the plots. E.g. if I plo

Re: [R] assign estimated values

2013-02-11 Thread Rui Barradas
Hello, Em 11-02-2013 01:26, Pete Brecknock escreveu: malaka wrote Hi, I want to assign the ar1 , ma 1 and the intercept estimated by the following code to three variables a, b and c respectively. Can anyone help me with this please? code: a0 = 0.05; a1 = 0.1; b1 = 0.85 nu = rnorm(2500) epsi

Re: [R] How to plot doubles series with different location using plotCI

2013-02-11 Thread Jim Lemon
On 02/11/2013 08:01 PM, linde wrote: Dear list members, I would like to create two series of plotted mean values and error bars, yet with different locations along the x-axis. Plotting of first series using plotCI with the standard arguments goes without any problem. However I do not succeed t

[R] Quadratic Active set technique

2013-02-11 Thread Pulkit Mehrotra
Hello everyone, I was going through the optimization techniques implemented in R. I was able to find most of the techniques that have been ported in R leaving a few. Can anyone tell me if a package on quadratic Active set technique has been developed in R as this was one of the requirements of my

Re: [R] How to plot doubles series with different location using plotCI

2013-02-11 Thread Jose Iparraguirre
Hi Rosalinde, If you set the argument err equal to "x", you'll get horizontal error bars. Hope this helps, José José Iparraguirre Chief Economist Age UK T 020 303 31482 E jose.iparragui...@ageuk.org.uk Twitter @jose.iparraguirre@ageuk Tavis House, 1- 6 Tavistock Square London, WC1H 9NB www.ag

Re: [R] Simple frequencies using svy design

2013-02-11 Thread Milan Bouchet-Valat
Le lundi 11 février 2013 à 10:37 +0100, Virgile Capo-Chichi a écrit : > Hello, > excuse me if this is trivial. I have some survey data with the following > design > > MyDesign<-(id=ident, weights=~fwgt, fcp=~nval1+nval2, data=hh_data1) > > I would like to run simple frequency tables such as those

Re: [R] convert 12 time stamp to 24 hour

2013-02-11 Thread e-letter
On 08/02/2013, e-letter wrote: > Readers, > > For a 12 hour time stamp: > >> testtime<-("2013-01-01 01:00:01 PM") >> testtime > [1] "2013-01-01 01:00:01 PM" >> testtime24hour<-strftime(testtime,'%H:%M:%S') >> testtime24hour > [1] "01:00:01" > Have realised that the object is of type 'character'.

[R] Simple frequencies using svy design

2013-02-11 Thread Virgile Capo-Chichi
Hello, excuse me if this is trivial. I have some survey data with the following design MyDesign<-(id=ident, weights=~fwgt, fcp=~nval1+nval2, data=hh_data1) I would like to run simple frequency tables such as those provided by the freq() function of rgrs to check the impact of the sampling design

Re: [R] BRugs Error

2013-02-11 Thread Uwe Ligges
On 10.02.2013 22:43, David Winsemius wrote: On Feb 10, 2013, at 12:28 PM, Uwe Ligges wrote: On 10.02.2013 21:18, Paul Ossenbruggen wrote: I installed XCode, XQuartz and OpenBUGS on my Mac using WINE. When I tried to test my installation I received the following error. If correct,

[R] how to make a median line thicker in bwplot (lattice)

2013-02-11 Thread Elaine Kuo
Hello, I am drawing a boxplot using bwplot in lattice. I would like to learn how to draw a thicker median line instead of the default setting. Thank you. Code bwplot(, pch=rep("|",2)) Elaine [[alternative HTML version deleted]] _

[R] How to plot doubles series with different location using plotCI

2013-02-11 Thread linde
Dear list members, I would like to create two series of plotted mean values and error bars, yet with different locations along the x-axis. Plotting of first series using plotCI with the standard arguments goes without any problem. However I do not succeed to add the second series in the same pl

Re: [R] how to plot growth chart like this

2013-02-11 Thread zhu yao
Thank you very much for the reference about methodology. I will try the GAMLESS package. *Yao Zhu* *Department of Urology Fudan University Shanghai Cancer Center Shanghai, China* 2013/2/11 David Winsemius > > On Feb 10, 2013, at 11:36 PM, zhu yao wrote: > > Dear R-users >> >> I want to genera

Re: [R] how to plot growth chart like this

2013-02-11 Thread David Winsemius
On Feb 10, 2013, at 11:36 PM, zhu yao wrote: Dear R-users I want to generate a growth chart like this: http://php.med.unsw.edu.au/embryology/images/9/9a/WHO-XX_length_birth_to_2_years.png can you give some suggestions about the functions I should use? Looking first at: http://www.who.int/e