Re: [R] Resurrecting old Splus objects

2012-02-15 Thread Prof Brian Ripley
Try read.S in package foreign. It was written back in the days of that S-PLUS format. On 16/02/2012 06:06, Patrick Connolly wrote: I have a small file of the type that S-PLUS produced and stored in .Data/ directories back in the days before we used R. I'm fairly sure it would become a datafram

Re: [R] variable ordering

2012-02-15 Thread Peter Langfelder
On Wed, Feb 15, 2012 at 10:22 PM, arunkumar wrote: > Hi, > > My input is > > x=c("D","A","B") > Y=c("A","B","C","D") > > varorder=which(Y %in% X) > > I'm getting result as  1 2 4 > But i need the result to be 4 1 2 Here's a hint: lookup the function match. Peter

[R] How to compare R-CNR tree regression results with R-NNet neural network result?

2012-02-15 Thread Rachit
Are there any result parameters which can be used to compare these algorithms? -- View this message in context: http://r.789695.n4.nabble.com/How-to-compare-R-CNR-tree-regression-results-with-R-NNet-neural-network-result-tp4392967p4392967.html Sent from the R help mailing list archive at Nabble.c

[R] variable ordering

2012-02-15 Thread arunkumar1111
Hi, My input is x=c("D","A","B") Y=c("A","B","C","D") varorder=which(Y %in% X) I'm getting result as 1 2 4 But i need the result to be 4 1 2 can any one help - Thanks in Advance Arun -- View this message in context: http://r.789695.n4.nabble.com/variable-ordering-tp4393109p4393

Re: [R] sequencing environments

2012-02-15 Thread Gabor Grothendieck
On Wed, Feb 15, 2012 at 11:58 PM, Ben quant wrote: > Thank you Duncan. Interesting. I find it strange that you can't get a list > of the environments. But I'll deal with it... > > Anyway, I'm about to start a new R dev project for my company. I'm thinking > about architecture, organization, and go

[R] Resurrecting old Splus objects

2012-02-15 Thread Patrick Connolly
I have a small file of the type that S-PLUS produced and stored in .Data/ directories back in the days before we used R. I'm fairly sure it would become a dataframe if read into Ver 3.4 of that august predecessor to what we use now. (It was Solaris in case that makes any difference.) AFAIK, the f

Re: [R] sequencing environments

2012-02-15 Thread Ben quant
Thank you Duncan. Interesting. I find it strange that you can't get a list of the environments. But I'll deal with it... Anyway, I'm about to start a new R dev project for my company. I'm thinking about architecture, organization, and gotchas. I went through much of the documentation you sent me.

Re: [R] Converting ts into xts and subsetting

2012-02-15 Thread P.B. Lecavalier
Thank you for your replies. That can be quite tricky indeed. The data consists of monthly unemployment rates, which I get as a text file along with the information: monthly, period of beginning and end. So it does not come with some timestamp as I specify the time inside R. This tweak time(X2

Re: [R] Converting ts into xts and subsetting

2012-02-15 Thread Gabor Grothendieck
On Wed, Feb 15, 2012 at 10:25 PM, P.B. Lecavalier wrote: > Greetings, > > I would like to subset observations in a time series using xts, after > converting from ts to xts. > > X=ts(1:100, frequency=12, start=c(1976)) > X2=as.xts(X) > X2["1984"] > > The output: > > Feb 1984   98 > Mar 1984   99 >

Re: [R] Converting ts into xts and subsetting

2012-02-15 Thread R. Michael Weylandt
Time zones strike again! In short, your problem is that your machine is probably not in UTC for its timezone (and it probably shouldn't be) so 12:00am Jan1 in London is still Dec31 for you. To see this directly, look at as.POSIXct(time(X2)) -- you'll see that item 97 which "should be" Jan 1 is act

Re: [R] R Package "example" section of .Rd file question (think it's a non-ASCII issue, but not sure...)

2012-02-15 Thread Ben Ganzfried
thanks! this was very helpful-- ultimately changed the name although it was a little confusing to do so... On Wed, Feb 15, 2012 at 6:12 PM, David Winsemius wrote: > > On Feb 15, 2012, at 5:30 PM, Yihui Xie wrote: > > Man, the original reply told you to use backticks `` rather than >> double quot

[R] Converting ts into xts and subsetting

2012-02-15 Thread P.B. Lecavalier
Greetings, I would like to subset observations in a time series using xts, after converting from ts to xts. X=ts(1:100, frequency=12, start=c(1976)) X2=as.xts(X) X2["1984"] The output: Feb 1984 98 Mar 1984 99 Apr 1984 100 What happened to January? The index is always one month off, wit

Re: [R] Error in rep.int(boxwex, n) : negative length vectors are not allowed

2012-02-15 Thread William Dunlap
It looks like a bug in bxp (which plot(factor,numeric) calls) -- it tries to make a nGroup*nGroup long vector out of boxwex: > f <- rep(factor(as.character(1:25000)), len=5) > x <- sin(1:5) > boxplot(split(x, f)) Error in rep.int(boxwex, n) : cannot allocate vector of length 62500 For

Re: [R] [newbie] separating plot output from debug output

2012-02-15 Thread Tom Roche
Tom Roche Wed, 15 Feb 2012 17:43:05 -0500 >> 1 I'm plotting to PDF, so everytime I dev.off() creates a new file, >> and I want everything in one file (as does my boss :-) >> 2 I'm doing the work on a cluster, where I very much do not have >> root, and which has a fairly minimal set of install

Re: [R] function similar to ddply? + calculations based on previous row

2012-02-15 Thread R. Michael Weylandt
Hi, I got a little lost in your verbal description, but if I understand your code correctly (what is n?), I think I'd implement it with the split function: step i) make a single (hopefully vectorized) pass to get whatever split points you need (the offset is in this step); ii) use split() to break

Re: [R] assign same legend colors than in the grouped data plot

2012-02-15 Thread R. Michael Weylandt
This is certainly not a reproducible example, but this works fine for me. lets = factor(sample(letters[1:3], 10, TRUE)) plot(1:10, 1:10, col = lets) legend("topleft", legend = levels(lets), col = seq.int(length(lets)), lty = 1) Michael On Wed, Feb 15, 2012 at 9:35 AM, agent dunham wrote: > Dear

Re: [R] Error in rep.int(boxwex, n) : negative length vectors are not allowed

2012-02-15 Thread R. Michael Weylandt
Can you give minimal reproducible code? I'm worried about using strings for the x axis but it'll be easier to diagnose with data and actual code. Use dput() to put your data sample (not your whole data set) in email-friendly plain text. Michael On Wed, Feb 15, 2012 at 10:46 AM, carol white wrote

Re: [R] ggplot rank stack bar automatically.

2012-02-15 Thread R. Michael Weylandt
It looks like period is a factor, so you can reorder the factor levels however you wish and then plot them the same way. I believe recode() in library(car) is a popular function for doing this, but I haven't used it myself. Michael On Wed, Feb 15, 2012 at 11:34 AM, vd3000 wrote: > Hi, all, > > I

Re: [R] neuralnet problem

2012-02-15 Thread R. Michael Weylandt
I've never used neuralnet, but if this is like other modelling functions in R, you need to put the column names corresponding to the outputs, not the name of the object they came from. They might have been changed in creating the data frame so take a look at colnames(dt) Hope that helps, Michael

Re: [R] matching a sequence in a vector?

2012-02-15 Thread Gabor Grothendieck
On Tue, Feb 14, 2012 at 11:17 PM, Redding, Matthew wrote: > I've been trawling through the documentation and listserv archives on this > topic -- but > as yet have not found a solution.  I'm sure this is pretty simple with R, but > I cannot work out how without > resorting to ugly nested loops.

Re: [R] matching a sequence in a vector?

2012-02-15 Thread jim holtman
yet another solution (I think) > patrn<- c(1,2,3,4) > exmpl<- c(3,3,4,2,3,1,2,3,4,8,8,23,1,2,3,4,4,34,4,3,2,1,1,2,3,4) > indx <- embed(rev(seq_along(exmpl)), length(patrn)) > matches <- apply(indx, 1, function(.indx){ + all(exmpl[.indx] == patrn) + }) > indx[matches, 1L] [1] 23 13 6 > On We

Re: [R] Link to a Network computer

2012-02-15 Thread Duncan Murdoch
On 12-02-15 5:26 PM, wpcmba wrote: Issue: Connecting to a computer in a network. I would like to connect to a file on a computer on my internal network that has a different password. I have tried download.file and read.csv to no avail. When use this link in explorer it will prompt me for a user

[R] Using R with Netezza

2012-02-15 Thread rusernetezza
We've recently installed a Netezza server and I am trying to integrate the R GUI with this server and run functions using the server itself. I am able to successfully connect to the server, but cannot get any of the Netezza-specific R functions to work that exist in the package called "nza". Spec

Re: [R] matching a sequence in a vector?

2012-02-15 Thread Redding, Matthew
Thankyou all for your great, and creative solutions. There is definately more than one way to skin a cat. A colleague alerted me to another solution: seq.strt <- which( sapply( 1:(length(exmpl)-length(patrn)+1), function(i) isTRUE( all.equal( patrn, exmpl[ i + 0:(length(patrn)-1) ] ) ) ) ) Ap

[R] influence.measures()

2012-02-15 Thread helin_susam
Hi dear all, I'm wondering about the question that; Does the influence.measures(model) for linear models valid for general linear models such as logistic regression models? That is; If I fit the model like model <- glm( y~X1+X2, family=binomial) Then, if i apply the function "influence.measur

[R] Link to a Network computer

2012-02-15 Thread wpcmba
Issue: Connecting to a computer in a network. I would like to connect to a file on a computer on my internal network that has a different password. I have tried download.file and read.csv to no avail. When use this link in explorer it will prompt me for a username/password: file://hs-907/D$/

Re: [R] [newbie] separating plot output from debug output

2012-02-15 Thread ilai
If you don't dev.off(), all plots will be sent to the open graphical device. That usually doesn't impact behavior of other output types: pdf(file='fooout.pdf') hist(x <- rnorm(100)) y <- sin(x) print(str(y)) cat(y,file='fooout.txt') plot(x,y) dev.off() Hope this helps On Wed, Feb 15, 2012 at 3:4

Re: [R] R Package "example" section of .Rd file question (think it's a non-ASCII issue, but not sure...)

2012-02-15 Thread David Winsemius
On Feb 15, 2012, at 5:30 PM, Yihui Xie wrote: Man, the original reply told you to use backticks `` rather than double quotes "". They are very different in R; see ?Quotes And GSE19829-GPL570_eset is really a bad name. I recommend you to rename it. Regards, Yihui -- Yihui Xie Phone: 515-29

[R] [newbie] separating plot output from debug output

2012-02-15 Thread Tom Roche
I'm attempting to refactor an R script that does a lot of plotting, among other things. Ideally I'd like to do something like setup # does pdf(...) for each part of input { plot(process(part)) } cleanup # does dev.off() but have problems: 1 I'm plotting to PDF, so everytime I dev.off()

Re: [R] R Package "example" section of .Rd file question (think it's a non-ASCII issue, but not sure...)

2012-02-15 Thread Yihui Xie
Man, the original reply told you to use backticks `` rather than double quotes "". They are very different in R; see ?Quotes And GSE19829-GPL570_eset is really a bad name. I recommend you to rename it. Regards, Yihui -- Yihui Xie Phone: 515-294-2465 Web: http://yihui.name Department of Statistic

Re: [R] Using readBin to read binary "unformatted" output files from Fortran?

2012-02-15 Thread Jooil Kim
Hello Duncan, Thanks for the reply. I tried your command, and I got "raw(0)" in response… However, your response that I was on the right track was in fact very helpful, since I went back to my "header" file and found that the problem was the transfer from the Ubuntu instrument to my Mac. No

Re: [R] R Package "example" section of .Rd file question (think it's a non-ASCII issue, but not sure...)

2012-02-15 Thread Ben Ganzfried
Hi Martin, Thanks! You were right. Quotes seemed to work, except I kept running into a problem on the following line: time <- "GSE19829-GPL570_eset$days_to_death" / 365 The error is that R atomic vector operator invalid. It's actually much easier if I could use quotes rather than re-name-- so

Re: [R] Cannot use setClass() in Rscript

2012-02-15 Thread Jonathan Callahan
Brilliant! Problem solved and you have just saved me many hours of frustration. Thanks so much. On Wed, Feb 15, 2012 at 1:12 PM, Martin Morgan wrote: > On 02/15/2012 12:33 PM, Jonathan Callahan wrote: > >> Greetings, >> >> I am creating a standalone executable script using Rscript and have run

Re: [R] Using readBin to read binary "unformatted" output files from Fortran?

2012-02-15 Thread David Winsemius
On Feb 15, 2012, at 5:41 AM, Duncan Murdoch wrote: On 12-02-14 10:58 PM, Jooil Kim wrote: Hello, I'm wondering if I can get some help with reading Fortran binary "unformatted" output files into R. The Fortran output files were generated in Ubuntu 10.04 LTS using gfortran4.4, on a 32bit

Re: [R] how to test the random factor effect in lme

2012-02-15 Thread Greg Snow
This post https://stat.ethz.ch/pipermail/r-sig-mixed-models/2009q1/001819.html may help you understand why the standard p-values in some cases are not the right thing to do and what one alternative is. On Tue, Feb 14, 2012 at 3:36 PM, Xiang Gao wrote: > Hi > > I am working on a Nested one-way ANO

Re: [R] function similar to ddply? + calculations based on previous row

2012-02-15 Thread Nerak
I saw I made a little mistake in the loop, in the line test.number$numberb[y-Year[1]+1]<-length(which(test.starty==1 & test.f[(n+1)]== 1 )) it is n+1 instead of n-1 (like I wrote in the beginning) But the question I have about it is still the same. My excuzes Year<-data.frame(Date=c(1980,19

Re: [R] svm with GRASS GIS

2012-02-15 Thread gab
Ciao Etienne, thank you. Today I tried to understand something more. Here's what I did (The file names are a bit different): *training <- data.frame(cbind(TL_training_2006_id, AST_L1B_2008_05_2009_area_giusta_1, AST_L1B_2008_05_2009_area_giusta_2, AST_L1B_2008_05_2009_area_giusta_3N))* Then ... *x

Re: [R] R citation for the 2012

2012-02-15 Thread peter dalgaard
On Feb 15, 2012, at 17:29 , gianni lavaredo wrote: > Dear Reasearchers, > > I am writing a report and i need (and wish) cite R. somebody know the > citation of R for the 2012? or the more actual? There's no released R version from 2012 -- yet. Wait two weeks and there will be one. -pd -- Pe

Re: [R] save objects of own function to workspace

2012-02-15 Thread Rolf Turner
On 16/02/12 03:59, Marion Wenty wrote: Thank you for your answers! Jeff, thanks very much for the tip with the<<- instead of using<- to save the objects outside of the function, as well! I find this very usefull and convenient, also if I decide to choose more objects. This practice is to be

Re: [R] R Package "example" section of .Rd file question (think it's a non-ASCII issue, but not sure...)

2012-02-15 Thread Martin Morgan
On 02/15/2012 12:18 PM, Ben Ganzfried wrote: Hey, I keep getting the following warning: data(GSE19829-GPL570_eset) Warning in data(GSE19829 - GPL570_eset) : data set ‘GSE19829 - GPL570_eset’ not found ## maybe str(GSE19829-GPL570_eset) ; plot(GSE19829-GPL570_eset) ... Hi Ben -- '-' is

Re: [R] Cannot use setClass() in Rscript

2012-02-15 Thread Martin Morgan
On 02/15/2012 12:33 PM, Jonathan Callahan wrote: Greetings, I am creating a standalone executable script using Rscript and have run into problems when I define a new S4 class. Here is a small script that demonstrates my problem: Hi -- Check out the difference between R --vanilla -e "sessio

[R] neuralnet problem

2012-02-15 Thread Luc MOULINIER
Hello List ! I'm a bright new R user, and I encounter a problem when trying to use the neuralnet package. I have a training set with 8 inputs, and there are 3 outputs (I need 3 distinct neurones as output). Although I read the examples, and the package article, I don't know how to tell R there

[R] Cannot use setClass() in Rscript

2012-02-15 Thread Jonathan Callahan
Greetings, I am creating a standalone executable script using Rscript and have run into problems when I define a new S4 class. Here is a small script that demonstrates my problem: #!/usr/bin/env Rscript # # toy.Rscript -- testing S4 class creation in an Rscript setClass("toy", representation(n

Re: [R] R citation for the 2012

2012-02-15 Thread R. Michael Weylandt
I'm not sure what the "official description" of R is beyond that given in citation(), but the R FAQ gives this: "[R] consists of a language plus a run-time environment." Part of R's personality, as far as I can tell, comes from the fact it straddles the general purpose language/domain specific lang

[R] R Package "example" section of .Rd file question (think it's a non-ASCII issue, but not sure...)

2012-02-15 Thread Ben Ganzfried
Hey, I keep getting the following warning: > data(GSE19829-GPL570_eset) Warning in data(GSE19829 - GPL570_eset) : data set ‘GSE19829 - GPL570_eset’ not found > ## maybe str(GSE19829-GPL570_eset) ; plot(GSE19829-GPL570_eset) ... > > if(require(affy)){ + summary(GSE19829-GPL570_eset$vital_statu

Re: [R] Plotting monthly maps from yearly data

2012-02-15 Thread R. Michael Weylandt
. you don't really consider this a well formed question do you? (Among others:) http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example http://www.gerv.net/hacking/how-to-ask-good-questions/ What immediately comes to mind: i) Plotting engine? (base, lattice, or

Re: [R] question

2012-02-15 Thread peter dalgaard
On Feb 15, 2012, at 15:17 , R. Michael Weylandt wrote: > But that's dropping unused factor levels, not the drop of `[` Is there a good reason that nobody has suggested looking at aggregate()? There would seem to be a little red tape to sort out, but, I mean, this is generally speaking what agg

[R] Plotting monthly maps from yearly data

2012-02-15 Thread uday
I have some data set which is available from 2005-2010 . I would like plot monthly maps out of it. So how I should write loop that can plot this yearly data to for every month and write title for individual months too. -- View this message in context: http://r.789695.n4.nabble.com/Plotting-mo

Re: [R] Filling out a data frame row by row.... slow!

2012-02-15 Thread ilai
First, in R there is no need to declare the dimensions of your objects before they are populated so couldn't you reduce some run time by not going through the double data.frame step ? > df<- data.frame() > df data frame with 0 columns and 0 rows > for(i in 1:100) for(j in 1:3) df[i,j]<- runif(1) >

Re: [R] Rpart decision tree

2012-02-15 Thread Achim Zeileis
On Wed, 15 Feb 2012, dlofaro wrote: Dear R-Users, I'm a R beginner and I have a similar problem: I fitted a SurvivalTree with rpart and I'm tryng to plot with the partykit package by the funcion as.party but it sends me this error: plot(as.party(rpartSurv)) Error in plot.constparty(as.party(r

[R] Control number of assets in resulting portfolio with optimizations using package fPortfolio

2012-02-15 Thread Alexander Erbse
Dear All, I am using package fPortfolio to run minimum variance portfolio optimizations in R. I already know how to set portfolioSpecs, portfolio objects and constraints. Unfortunately I am not able to set the following type of constraints. I have a timeSeries object with returns data for roug

Re: [R] model fitting

2012-02-15 Thread Tsjerk Wassenaar
Hi Tony, ?nls Cheers, Tsjerk On Feb 15, 2012 8:03 PM, "Anthony Fristachi" wrote: Greetings, Any suggestions for approaching the fitting of the function y = b/exp(a*x) + c*x + y0 where a, b, c, and y0 are unknown constants and y and x are variables in a give dataset. Thanks Tony

[R] model fitting

2012-02-15 Thread Anthony Fristachi
Greetings, Any suggestions for approaching the fitting of the function y = b/exp(a*x) + c*x + y0 where a, b, c, and y0 are unknown constants and y and x are variables in a give dataset. Thanks Tony [[alternative HTML version deleted]]

Re: [R] Filling out a data frame row by row.... slow!

2012-02-15 Thread William Dunlap
environment[[names[j]]][i]<-I does seem to take longer than environment$name[i]<-I when looping over the length of the vector involved. Using a list instead of an environment seems to work better. Below are 4 functions that populate a data.frame row by row. f0 : the naïve approach f1 : use

Re: [R] dotplots with error bars

2012-02-15 Thread Colin Wahl
Thank you, Its looking like your package will work for me. I have two questions. First, how do I rotate the plot 90 degrees so the group labels are on the x axis and the response value on the y axis? Second, I'm having trouble with the group labels. I need to order my groups into meaningful group

[R] [R-pkgs] New version: dclone 1.7-1 and dcmle 0.1-4 rolled out

2012-02-15 Thread Peter Solymos
Dear R Community, I am happy to introduce the next release of the *dclone* package (see R Journal, 2(2): 29-37, 2010) which now includes a suite of functions for parallel computations: - see functions parJagsModel, parUpdate, parCodaSamples using 'snow' type clusters; and the - jags.parfit functi

[R] [R-pkgs] new package on CRAN: multivator

2012-02-15 Thread robin hankin
Dear list, The new package 'multivator' is now available on CRAN. This presents a multivariate generalization of the emulator package. The corresponding JSS article is: Robin K. S. Hankin (2012), "Introducing multivator: A Multivariate Emulator", Journal of Statistical Software, 46(8), 1-20.

Re: [R] built a lower triangular matrix from dataframe

2012-02-15 Thread Rui Barradas
Hello, > > I'm trying to build a lower triangular matrix (with zeros in the diagonal) > from a particular dataframe. > This example constructs a lower triangular matrix from a vector, not a data.frame. (In your example, you also use a vector, the last column of the DF.) x <- runif(15) y <- matri

Re: [R] Rpart decision tree

2012-02-15 Thread dlofaro
Dear R-Users, I'm a R beginner and I have a similar problem: I fitted a SurvivalTree with rpart and I'm tryng to plot with the partykit package by the funcion as.party but it sends me this error: > plot(as.party(rpartSurv)) Error in plot.constparty(as.party(rpartSurv)) : node_surv not yet imple

Re: [R] LaTeX and Sweave on windows

2012-02-15 Thread Yihui Xie
Please read the very last two lines in the footer of your email below. Regards, Yihui -- Yihui Xie Phone: 515-294-2465 Web: http://yihui.name Department of Statistics, Iowa State University 2215 Snedecor Hall, Ames, IA On Wed, Feb 15, 2012 at 8:55 AM, Bos, Roger wrote: > I am completely new t

Re: [R] help in run if

2012-02-15 Thread William Dunlap
runif's min and max argument may be vectors: > x=c(0,0,0,0,0) > y=c(10,20,30,40,50) > runif(length(y), min=x, max=y) [1] 7.005180 14.035296 9.388089 22.094211 43.624606 This is equivalent to x + (y-x)*runif(length(y)) but such a transformation is not always so easy for nonuniform random

Re: [R] Plotting function image

2012-02-15 Thread ilai
Inline On Wed, Feb 15, 2012 at 3:04 AM, uday wrote: > Hi , > > Thanks for reply > > My latitude and longitude contains 9-10 observations per file > when I run coords <- expand.grid(lat=1:5,long=1:5) then my computer > You don't have to run this part. As your original post did not provide

Re: [R] smooth.spline() unique 'x' values error

2012-02-15 Thread Prof Brian Ripley
On 15/02/2012 15:00, Nicholas Reich wrote: Hello. I'm getting an unexpected result when running smooth.spline(). Here is a simple example that replicates the error I'm getting: aa<- c(1, 2, 3, 8, 8, 8, 8, 8, 8, 8, 8, 8, 12, 13, 14) bb<- 1:length(aa) plot(aa, bb) smooth.spline(aa, bb) Error i

Re: [R] R citation for the 2012

2012-02-15 Thread gianni lavaredo
Sorry I don't know the citation inside the report is corret The Analysis was done using a script written in the statistical computing environment of R (R Development Core Team, 2011) is It correct the form "statistical computing environment" ? Gianni On Wed, Feb 15, 2012 at 5:38 PM, Sarah Gos

Re: [R] built a lower triangular matrix from dataframe

2012-02-15 Thread David Winsemius
On Feb 15, 2012, at 11:47 AM, nymphita wrote: Hi Tsjerk! Thanks for your quick reply! It's a nice way to built a lower triangular matrix with zeros in the diagonal, but what I can't work out is *how to include the values of the third column of the dataframe inside the matrix*. I just reali

Re: [R] integrate (error: evaluation of function gave a result of wrong length)

2012-02-15 Thread Uwe Ligges
On 15.02.2012 17:33, Dimitris.Kapetanakis wrote: Dear all, I am trying to use the integrate function in R but it seems that it does not work in my example and I cannot figure out why. I create a function Mu1 (which works fine) and try to integrate by the code: n <- 100 Ctrl<

Re: [R] integrate (error: evaluation of function gave a result of wrong length)

2012-02-15 Thread R. Michael Weylandt
Integrate works on functions that are vectorized (i.e., the algorithm puts in N inputs and expects N outputs) -- your function is not vectorized (and I'm not sure what integrating it means, but I'm not looking too closely) but you can make it "look vectorized" with the Vectorize() HOF. Note that th

Re: [R] built a lower triangular matrix from dataframe

2012-02-15 Thread R. Michael Weylandt
Perhaps ignore the lower-triangularity for a moment and do something like this: x <- matrix(NA, ncol = max(j), nrow = max(i)) x[i, j] <- k Your code will be clearer if you use with() rather than df$i constructs. Hope this helps, Michael On Wed, Feb 15, 2012 at 11:47 AM, nymphita wrote: > Hi T

Re: [R] working on a vector with named elements - unname

2012-02-15 Thread William Dunlap
Typo below, 'latter' -> 'former'. namedVector[[i]] drops the names and namedVector[i] does not. 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 William Dunlap > Sent: W

Re: [R] built a lower triangular matrix from dataframe

2012-02-15 Thread nymphita
Sorry, I just realized that it's not a lower triangualr matrix, but an upper triangular matrix! But still the solution/s should be rather similar in both cases. http://r.789695.n4.nabble.com/file/n4391127/matrix2.png I apologize for creating confusion... Nymphita -- View this message in context

Re: [R] working on a vector with named elements - unname

2012-02-15 Thread William Dunlap
You could use [[ instead of [, as the latter drops the names. E.g., after > v <- c("a"=3,"a"=4,"c"=5,"d"=6) change your > c("n"=v["a"]+v["c"],"n1"=v["d"]*3) # "n.a"=8 "n1.d"=18 n.a n1.d 8 18 to > c("n"=v[["a"]]+v[["c"]],"n1"=v[["d"]]*3) # "n"=8 "n1"=18 n n1 8 18 Bill Dunl

Re: [R] Parameter estimation of gamma distribution

2012-02-15 Thread Prof Brian Ripley
On 15/02/2012 14:18, Yogs wrote: Hi, I am trying to estiamte parameters for gamma distribution using mle for below data using fitdist& fitdistr functions which are from "fitdistrplus" & "MASS"packages . I am getting errors for both functions. Can someone please let me know how to overcome th

[R] ggplot rank stack bar automatically.

2012-02-15 Thread vd3000
Hi, all, I am currently trying to learn this example. http://learnr.wordpress.com/2009/03/17/ggplot2-barplots/ I created the stack bar easily. If I would like to rank the stack bar from the highest on the right, shortest on the left and eventually I could show the data "1991-00" on the left

Re: [R] built a lower triangular matrix from dataframe

2012-02-15 Thread nymphita
Hi Tsjerk! Thanks for your quick reply! It's a nice way to built a lower triangular matrix with zeros in the diagonal, but what I can't work out is *how to include the values of the third column of the dataframe inside the matrix*. I just realized that I forgot to explain something about the data

[R] integrate (error: evaluation of function gave a result of wrong length)

2012-02-15 Thread Dimitris.Kapetanakis
Dear all, I am trying to use the integrate function in R but it seems that it does not work in my example and I cannot figure out why. I create a function Mu1 (which works fine) and try to integrate by the code: n <- 100 Ctrl<- as.matrix(cbind(runif(n, -30, 30))) W

[R] bootstrapping quantile regression

2012-02-15 Thread Julia Lira
Dear all, I am currently running an experiment using quantile regression. In order to get more accurate results for a hypothesis test, I need to run a bootstrapping version of quantile regression and I need to find the estimated covariance matrix among all the coefficients for several quantiles

Re: [R] R citation for the 2012

2012-02-15 Thread Sarah Goslee
Typing citation() at an R prompt will provide you with complete citation information for the version of R you are using. Same goes for packages, with citation("pkgname"). Sarah On Wed, Feb 15, 2012 at 11:29 AM, gianni lavaredo wrote: > Dear Reasearchers, > > I am writing a report and i need (and

Re: [R] R citation for the 2012

2012-02-15 Thread Jorge I Velez
Hi gianni, Type "citation()" without quotes in the R console. You will get something like To cite R in publications use: R Development Core Team (2011). R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. ISBN 3-900051-07-0,

[R] R citation for the 2012

2012-02-15 Thread gianni lavaredo
Dear Reasearchers, I am writing a report and i need (and wish) cite R. somebody know the citation of R for the 2012? or the more actual? thanks in advance Gianni [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https:/

Re: [R] working on a vector with named elements - unname

2012-02-15 Thread Alexander
Thanks for your help. I already considered using list. But as I want to put some constraints on the entries and the form of the vector, I thought it would be easier to verify them by using a vector instead of a list. -- View this message in context: http://r.789695.n4.nabble.com/working-on-a-vect

Re: [R] built a lower triangular matrix from dataframe

2012-02-15 Thread Tsjerk Wassenaar
Hi Nymphita, ?upper.tri x <- as.data.frame(matrix(1:6,6,6)) x[upper.tri(x,diag=TRUE)] <- 0 x Cheers, Tsjerk On Wed, Feb 15, 2012 at 4:33 PM, nymphita wrote: > Hello! > > I'm trying to build a lower triangular matrix (with zeros in the diagonal) > from a particular dataframe. > > The matrix I

[R] function similar to ddply? + calculations based on previous row

2012-02-15 Thread Nerak
Hi all, I was wondering if there is a function kind of similar that splits a dataframe, applies a function to each row and returns in a data frame. I know ddply but this one isn’t useful in this situation. I have a dataframe with values for each day (rows) for different objects (columns). I have

[R] built a lower triangular matrix from dataframe

2012-02-15 Thread nymphita
Hello! I'm trying to build a lower triangular matrix (with zeros in the diagonal) from a particular dataframe. The matrix I have to construct has 203 rows and 203 columns and that makes 20503 values to be included within (that's why I can't do it manually). To illustrate the dataframe I have, I

[R] smooth.spline() unique 'x' values error

2012-02-15 Thread Nicholas Reich
Hello. I'm getting an unexpected result when running smooth.spline(). Here is a simple example that replicates the error I'm getting: > aa <- c(1, 2, 3, 8, 8, 8, 8, 8, 8, 8, 8, 8, 12, 13, 14) > bb <- 1:length(aa) > plot(aa, bb) > smooth.spline(aa, bb) Error in smooth.spline(aa, bb) : need at l

[R] Parameter estimation of gamma distribution

2012-02-15 Thread Yogs
Hi, I am trying to estiamte parameters for gamma distribution using mle for below data using fitdist & fitdistr functions which are from "fitdistrplus" & "MASS"packages . I am getting errors for both functions. Can someone please let me know how to overcome this issue?? data y1<- c(256656, 7637

[R] Fw: Error in rep.int(boxwex, n) : negative length vectors are not allowed-cont.

2012-02-15 Thread carol white
Sorry for the error: the first column is of the string type and the second column of float, respectively. - Forwarded Message - From: carol white To: "r-h...@stat.math.ethz.ch" Cc: Sent: Wednesday, February 15, 2012 4:46 PM Subject: Error in rep.int(boxwex, n) : negative length vector

Re: [R] working on a vector with named elements - unname

2012-02-15 Thread Petr PIKAL
Hi > Hi, I am working under R2.11.1 Windows. Rather old one, consider upgrading > I work with a set of parameters which is save under a vector. I think it is > easier to understand, which parameter is called in the vector by naming all > vector elements. For example, we have a vector which t

[R] Error in rep.int(boxwex, n) : negative length vectors are not allowed

2012-02-15 Thread carol white
Dear All, I tried to invoke plot for a matrix of 196475 x2 dimension. I loaded the data with read.table. On one dimension, there are strings (names) and on the other dimension, the floats between 0 and 1. When I invoked plot by setting x to names and y to floats and ylim = c(0,1), I got the foll

Re: [R] [fields] image.plot abends with NAs in image.plot.info

2012-02-15 Thread Tom Roche
Tom Roche Fri, Feb 3, 2012 at 11:16 AM >> summary: image.plot-ing two sets of netCDF data, with the second >> derived from the first. Should have noted that the data (atmospheric emissions) in * the second dataset is heavily positively-skewed. (This leads to a problem with the legend when plot

Re: [R] matching a sequence in a vector?

2012-02-15 Thread Berend Hasselman
On 15-02-2012, at 15:27, Martin Morgan wrote: > On 02/14/2012 11:45 PM, Petr Savicky wrote: >> On Wed, Feb 15, 2012 at 02:17:35PM +1000, Redding, Matthew wrote: >>> Hi All, >>> >>> >>> I've been trawling through the documentation and listserv archives on this >>> topic -- but >>> as yet have n

Re: [R] matching a sequence in a vector?

2012-02-15 Thread Petr Savicky
On Wed, Feb 15, 2012 at 06:27:01AM -0800, Martin Morgan wrote: > On 02/14/2012 11:45 PM, Petr Savicky wrote: > >On Wed, Feb 15, 2012 at 02:17:35PM +1000, Redding, Matthew wrote: > >>Hi All, > >> > >> > >>I've been trawling through the documentation and listserv archives on > >>this topic -- but >

Re: [R] save objects of own function to workspace

2012-02-15 Thread Marion Wenty
s_elternmz <- function(Var="balt") { Dg_a<-mz[,c("asbhh","apkz",Var)] colnames(Dg_a)[colnames(Dg_a)=="apkz"]<-"bpkzm" colnames(Dg_a)[colnames(Dg_a)==Var]<-paste(Var,"_m",sep="") mz_int<-merge(mz,Dg_a,by=c("asbhh","bpkzm"),all.x=T) colnames(Dg_a)[colnames(Dg_a)=="bpkzm"]<-"bpkzv" colnames

[R] LaTeX and Sweave on windows

2012-02-15 Thread Bos, Roger
I am completely new to LaTeX and Sweave, so I am trying to follow the tutorial in the following link: http://www.r-bloggers.com/using-latex-r-and-sweave-to-create-reports-in- windows/ I installed MiKTeX 2.9 and TeXnicCenter, but I get a build error when compiler the example file: The two errors a

Re: [R] svm with GRASS GIS

2012-02-15 Thread Etienne B. Racine
Gab, Make sure you have variables for each training. training <- data.frame(Training_2006, AST_L1B_1, AST_L1B_2, AST_L1B_3N) If you can't do that, then you don't have as many training observations than you have predictive informations. Make sure to create a line for each set of predictive pixels

[R] spplot settings

2012-02-15 Thread uday
I want to use spplot function for plotting data on wold map spplot.points(obj, zcol = names(obj), ..., names.attr, scales = list(draw = FALSE), xlab = NULL, ylab = NULL, aspect = mapasp(obj,xlim,ylim), panel = panel.pointsplot, sp.layout = NULL, identify = FALSE, formula,

[R] Finite mixtures of Generalized Linear Mixed models with random effects

2012-02-15 Thread mariastatistics
Hello to everybody !!! I am a student in the Mathematics department of the university of Milano. I am interested in an r -package or an available code for fitting two component mixtures of generalized linear mixed effects models for cluster correlated data. In particular with normal random effec

[R] assign same legend colors than in the grouped data plot

2012-02-15 Thread agent dunham
Dear community, I've plotted data and coloured depending on the factor variable v3. In the legend, I'd like to assign properly the same colors than in the factor (the factor has 5 levels). I've been trying this but it doesn't work. plot(var1, var2, xlab = "var1", ylab = "var2", col =var3 , b

Re: [R] matching a sequence in a vector?

2012-02-15 Thread Martin Morgan
On 02/14/2012 11:45 PM, Petr Savicky wrote: On Wed, Feb 15, 2012 at 02:17:35PM +1000, Redding, Matthew wrote: Hi All, I've been trawling through the documentation and listserv archives on this topic -- but as yet have not found a solution. I'm sure this is pretty simple with R, but I cannot

Re: [R] Passing date as parameter while retrieving data from database using dbGetQuery

2012-02-15 Thread Gabor Grothendieck
On Wed, Feb 15, 2012 at 7:24 AM, aajit75 wrote: > > Hi All, > This might be simple question, I need to retrive data for modelling from the > databases. Eveytime date values changes so I countnot fix date value in the > code, it is required to pass as parameter. > When I pass the date as parameter,

Re: [R] question

2012-02-15 Thread R. Michael Weylandt
But that's dropping unused factor levels, not the drop of `[` Michael On Wed, Feb 15, 2012 at 9:16 AM, David Winsemius wrote: > > On Feb 15, 2012, at 7:19 AM, R. Michael Weylandt wrote: > >> Sorry about that -- forgot the case where you might only have a >> certain entry once: try this, >> >> sa

  1   2   >