Re: [R] MAtrix addressing

2011-01-25 Thread Alaios
The reason is the following image http://img545.imageshack.us/i/maptoregion.jpg/ In the picture above you will find the indexes for each cell. Also you will see that I place that matrix inside a x,y region that spans from -1 to 1. I am trying to write one function that will get as argument a (x,y

Re: [R] Failing to install {rggobi} on win-7 R 2.12.0

2011-01-25 Thread Prof Brian Ripley
On Tue, 25 Jan 2011, Tom La Bone wrote: I recall that my problem on Windows was related to having a number of stray versions of GTK+ installed. I went back and deleted all versions and reinstalled the latest GTK+ and that seemed to fix things. However, when I went to do any work of substance ggo

Re: [R] Sweave: \Sexpr{} inside <<>>?

2011-01-25 Thread Dieter Menne
zerfetzen wrote: > > Is it possible in Sweave to put \Sexpr{} inside <<>>? This is a bad > example, but here goes: > > <> > Age <- 5 > @ > > <<>> > x <- \Sexpr{Age} > @ > ... > It's good to have a simplified example, but your's is so much simplified that it is difficult to understand. I kno

Re: [R] crash when using hazard.ratio.plot from rms package

2011-01-25 Thread Dennis Murphy
Hi: >From the function's Description on its help page: The hazard.ratio.plot function repeatedly estimates Cox regression coefficients and confidence limits within time intervals. The log hazard ratios are plotted against the mean failure/censoring time within the interval. It would appear

Re: [R] Counting number of rows with two criteria in dataframe

2011-01-25 Thread Dennis Murphy
Hi: Here are two more candidates, using the plyr and data.table packages: library(plyr) ddply(X, .(x, y), function(d) length(unique(d$z))) x y V1 1 1 1 2 2 1 2 2 3 2 3 2 4 2 4 2 5 3 5 2 6 3 6 2 The function counts the number of unique z values in each sub-data frame with the same x and y

Re: [R] Extracting SSE from lm

2011-01-25 Thread Brian J Mingus
Thanks all. Dennis provided the answer I was looking for - deviance(lm). Cheers, Brian On Tue, Jan 25, 2011 at 8:48 PM, Dennis Murphy wrote: > Hi: > > On Tue, Jan 25, 2011 at 10:36 AM, Greg Snow wrote: > >> It is not clear what you are doing or why you are doing it. If you tell >> us your ul

Re: [R] Using diff and transform

2011-01-25 Thread David Winsemius
On Jan 25, 2011, at 9:58 PM, eric wrote: I want to use diff to take the differences in a column "Close" of a data frame "y". But I'd like to do it using the transform function so a new data frame is created with a difference column. The problem is that diff gives one less than the numbe

[R] Defining and objective function in fPortfolio package

2011-01-25 Thread Luis Felipe Parra
Hello I am using the fPortfolio package and I see there is the option in the model slot "objRisk" which permits the user to define its own objective function. I have the ebook Portfolio Optimization with Rmetrics and there it says examples on this option are on the advanced version of the book, whi

[R] Sweave: \Sexpr{} inside <<>>?

2011-01-25 Thread zerfetzen
Hi, Is it possible in Sweave to put \Sexpr{} inside <<>>? This is a bad example, but here goes: <> Age <- 5 @ <<>> x <- \Sexpr{Age} @ I'm trying to get it to display x <- 5, rather than x <- Age. It's probably so obvious I'm going to feel sorry for having to ask, just the same, I'm stumped.

Re: [R] Extracting SSE from lm

2011-01-25 Thread Dennis Murphy
Hi: On Tue, Jan 25, 2011 at 10:36 AM, Greg Snow wrote: > It is not clear what you are doing or why you are doing it. If you tell us > your ultimate goal we may be able to help you find a way that does not > require all the computing that you are doing. > > How do you get your coefficients? Are

Re: [R] Extract NA data rows

2011-01-25 Thread typhoong
big thanks for all answers ! -- View this message in context: http://r.789695.n4.nabble.com/Extract-NA-data-rows-tp3235568p3237309.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/

Re: [R] how to get loglik parameter from splm package?

2011-01-25 Thread zhaowei
thank Millo for your very valuable reply The political situation in Italy may be better than in china. And wish logik function could be supported in FE models too. If then ,Splm will be more welcome. thanks for your all works for useR. Millo Giovanni wrote: > > Dear useR, > > although I

Re: [R] Failing to install {rggobi} on win-7 R 2.12.0

2011-01-25 Thread Tom La Bone
I recall that my problem on Windows was related to having a number of stray versions of GTK+ installed. I went back and deleted all versions and reinstalled the latest GTK+ and that seemed to fix things. However, when I went to do any work of substance ggobi locked up and became unresponsive. Neve

[R] plot with 2 y axes

2011-01-25 Thread Mario Beolco
Dear R users, apologies for the total beginner's question. I would like to create a barchart for some temperature values with the y axis on the right hand side of the plot. On this plot would like to overlay some time series data (in the form of a line) for some other variable called Index. The y

Re: [R] function application

2011-01-25 Thread Roy Shimizu
On Tue, Jan 25, 2011 at 5:12 PM, Phil Spector wrote: > ?do.call Erik, Phil, thanks! Roy __ 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

[R] Using diff and transform

2011-01-25 Thread eric
I want to use diff to take the differences in a column "Close" of a data frame "y". But I'd like to do it using the transform function so a new data frame is created with a difference column. The problem is that diff gives one less than the number of elements in the original data frame. So transfo

Re: [R] write.table -- maintain decimal places

2011-01-25 Thread Peter Ehlers
On 2011-01-25 17:22, Jim Moon wrote: Thank you for the response, Peter. The approach: write.table(format(df, drop0trailing=FALSE),file='df.txt',quote=F,sep='\t',row.names=F) surprisingly still results in some loss of trailing 0's. Here are a couple more (essentially identical) ways: # 1. df

Re: [R] NA replacing

2011-01-25 Thread Dennis Murphy
Hi: Here's one approach: f <- function(df) { rs <- with(na.exclude(df), tapply(y, strata, sum)/tapply(x, strata, sum)) u <- transform(subset(df, is.na(y)), y = x * rs[strata]) transform(df, y = replace(y, u$id, u$y)) } f(df) The function works as follows: (1) With the rows of

Re: [R] MAtrix addressing

2011-01-25 Thread David Winsemius
On Jan 25, 2011, at 4:50 PM, Alaios wrote: Hello I would like to ask you if it is possible In R Cran to change the default way of addressing a matrix. for example matrix(data=seq(from=1,to=4,nrow=2,ncol=2, by row numbering) # not having R at this pc will create something like the followi

Re: [R] return object from loop inside a function

2011-01-25 Thread Phil Spector
Nicolas - Along with returning a value, the return function passes control back to the caller of the function. So any statement after a return statement will just be ignored. In R the way this is handled is by returning a list. Change return(pop) return(grid.dens) to return(list(pop=pop

Re: [R] crash when using hazard.ratio.plot from rms package

2011-01-25 Thread Peter Ehlers
On 2011-01-25 17:08, Hongying Li wrote: Dear all, I always encounter a crash when running hazard.ratio.plot from rms package with my predictor as a factor. It works fine when the predictor is a continous score. Anyone encounters this too? Is this a bug or something? Could you define "crash" f

Re: [R] Failing to install {rggobi} on win-7 R 2.12.0

2011-01-25 Thread Yihui Xie
According to my experience, you should NOT download the GTK version from GGobi's website. That version won't work for R 2.12.0 and rggobi. So first, remove that version of GTK; then follow the instructions from library(RGtk2) to download and install the more recent version of GTK+. Then everything

Re: [R] Counting number of rows with two criteria in dataframe

2011-01-25 Thread David Winsemius
On Jan 25, 2011, at 2:25 PM, Ryan Utz wrote: Hi R-users, I'm trying to find an elegant way to count the number of rows in a dataframe with a unique combination of 2 values in the dataframe. My data is specifically one column with a year, one with a month, and one with a day. I'm trying to

[R] return object from loop inside a function

2011-01-25 Thread Nicolas Gutierrez
Hi All, I have a for loop inside the function and I cannot get UUU to give me an updated grid.dens object when I run the function (it does update when I run just the for loop). Here's a simplified version of my function: UUU=function(pop, grid.dens) { for (i in 1:10){ Food=grid.dens[pop$yloc

Re: [R] write.table -- maintain decimal places

2011-01-25 Thread Peter Ehlers
On 2011-01-25 17:22, Jim Moon wrote: Thank you for the response, Peter. The approach: write.table(format(df, drop0trailing=FALSE),file='df.txt',quote=F,sep='\t',row.names=F) surprisingly still results in some loss of trailing 0's. What version of R? I'm using R version 2.12.1 Patched (2010-1

Re: [R] write.table -- maintain decimal places

2011-01-25 Thread Jim Moon
Thank you for the response, Peter. The approach: write.table(format(df, drop0trailing=FALSE),file='df.txt',quote=F,sep='\t',row.names=F) surprisingly still results in some loss of trailing 0's. df: EFFECT2 PVALUE 1 0.0230.88080 2 -0.260 0.08641 3 -0.114 0.45200 df.txt: EFFECT2PV

Re: [R] write.table -- maintain decimal places

2011-01-25 Thread Peter Ehlers
On 2011-01-25 16:16, Jim Moon wrote: Hello, All, How can I maintain the decimal places when using write.table()? Jim e.g. df: EFFECT2 PVALUE 1 0.0230.88080 2 -0.260 0.08641 3 -0.114 0.45200 write.table(df,file='df.txt',quote=F,sep='\t',row.names=F) write.table(format(df, drop0tr

[R] crash when using hazard.ratio.plot from rms package

2011-01-25 Thread Hongying Li
Dear all, I always encounter a crash when running hazard.ratio.plot from rms package with my predictor as a factor. It works fine when the predictor is a continous score. Anyone encounters this too? Is this a bug or something? Thanks, Lilian [[alternat

Re: [R] write.table -- maintain decimal places

2011-01-25 Thread Sebastian P. Luque
On Tue, 25 Jan 2011 16:16:37 -0800, Jim Moon wrote: > Hello, All, How can I maintain the decimal places when using > write.table()? Have a look at ?format.data.frame -- Seb __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/

[R] post-hoc comparisons in GAMs (mgcv) with parametric terms

2011-01-25 Thread Julian Burgos
Dear list, I´m wondering if there is something analogous to the TukeyHSD function that could be used for parametric terms in a GAM. I´m using the mgcv package to fit models that have some continuous predictors (modeled as smooth terms) and a single categorical predictor. I would like to do post

[R] write.table -- maintain decimal places

2011-01-25 Thread Jim Moon
Hello, All, How can I maintain the decimal places when using write.table()? Jim e.g. df: EFFECT2 PVALUE 1 0.0230.88080 2 -0.260 0.08641 3 -0.114 0.45200 write.table(df,file='df.txt',quote=F,sep='\t',row.names=F) df.txt: EFFECT2PVALUE 0.023 0.8808 -0.26 0.08641 -0.114

Re: [R] Does anybody knows the default value of starting value in glm?

2011-01-25 Thread Douglas Bates
On Tue, Jan 25, 2011 at 1:14 PM, Akram Khaleghei Ghosheh balagh wrote: > Hello ; > > Do you know what is the default value of starting value in glm ? glm(..., > start=c(),... ) > I know that it is NULL by default but it need a value to start iteration . > what is this value? Actually the typical

[R] ANOVA table look

2011-01-25 Thread Keith Jones
Y'all, I need to get the look of a "standard" fixed effect ANOVA table: anova(aov(meas~op*part,data=fs)) Analysis of Variance Table Response: meas Df Sum Sq Mean Sq F value Pr(>F) op 22.62 1.308 1.3193 0.2750 part 19 1185.43 62.391 62.9151 <2e-16 *** op:part 3

Re: [R] FW: question about the pt() calculation

2011-01-25 Thread Phil Spector
Matthew - Others will probably tell you about the folly of performing 1733 t-tests on groups with 4 observations each, but an alternative to your approach would be to use R to solve your problem. (I'm using var.equal=TRUE because that's what you're calculating, but you might consider using the

Re: [R] Train error:: subscript out of bonds

2011-01-25 Thread mxkuhn
You should try different tuning parameters; the defaults are not likely to work for many datasets. I don't use the polynomial kernel too much but scale parameter values that are really of could cause this. Unlike the rbf, I don't know of any good techniques for estimating this. Max On Jan 25,

Re: [R] function application

2011-01-25 Thread Phil Spector
?do.call Please provide a reproducible example if the help file is not sufficient. - Phil Spector Statistical Computing Facility Department of Statistics

Re: [R] function application

2011-01-25 Thread Erik Iverson
Suppose I have a function, like list, that takes a variable number of arguments, and I have those arguments in some vector x. How can execute the function with the *contents* of x as its arguments? I.e., I don't want list(x), but rather list(x[[1]], x[[2]], ..., x[[n]]), but I don't want to spel

[R] FW: question about the pt() calculation

2011-01-25 Thread Leitch, Matthew C.
From: Leitch, Matthew C. Sent: Monday, January 24, 2011 6:53 PM To: 'i...@network-theory.co.uk' Subject: question about the pt() calculation Hello Thank you for your time. I am a graduate student at the University of Texas Medical Branch, and I was wondering if you could help me with a R progr

[R] function application

2011-01-25 Thread Roy Shimizu
Suppose I have a function, like list, that takes a variable number of arguments, and I have those arguments in some vector x. How can execute the function with the *contents* of x as its arguments? I.e., I don't want list(x), but rather list(x[[1]], x[[2]], ..., x[[n]]), but I don't want to spell

Re: [R] 3D Binning

2011-01-25 Thread Petr Savicky
On Tue, Jan 25, 2011 at 06:00:36AM -0800, vioravis wrote: > > I am trying to do binning on three variables (3d binning). The bin boundaries > are specified by the user separately for each variable. I used the bin2 > function in the 'ash' package for 2d binning that involves only two > variables bu

[R] FW: question about the pt() calculation

2011-01-25 Thread Leitch, Matthew C.
From: Leitch, Matthew C. Sent: Monday, January 24, 2011 6:53 PM To: 'i...@network-theory.co.uk' Subject: question about the pt() calculation Hello Thank you for your time. I am a graduate student at the University of Texas Medical Branch, and I was wondering if you could help me with a R progr

[R] MAtrix addressing

2011-01-25 Thread Alaios
Hello I would like to ask you if it is possible In R Cran to change the default way of addressing a matrix. for example matrix(data=seq(from=1,to=4,nrow=2,ncol=2, by row numbering) # not having R at this pc will create something like the following 1 2 3 4 the way R address this matrix is from t

Re: [R] Manual two-stage least squares in R

2011-01-25 Thread Kevin Wright
Your question has some similarities this paper: Alison Smith, Brian Cullis, and Arthur Gilmour. The analysis of crop variety evaluation data in Australia. Aust. N. Z. J. Stat., 43:129--145, 2001. In that paper, the authors fit a mixed model with several random effects. The variances are then held

[R] lattice draw.key(): position of key in panels

2011-01-25 Thread Boris.Vasiliev
Good afternoon, I am working on a plot that requires custom legends to be placed in some panels of the plot; other panels do not contain legends. The problem that I run into is positioning of the legend in individual panels. In particular, the 'x' and 'y' elements of the key-list are ignored by d

[R] Manual two-stage least squares in R

2011-01-25 Thread Katharina Ley
Hi, I am trying to manipulate a gls regression model output to adjust for use of two-stage least squares. Basically, I want to estimate a model, then feed in a new set of residuals, then re-calculate all of the model output (i.e. the standard errors of the estimators, etc.). I have found some docu

Re: [R] Predictions with 'missing' variables

2011-01-25 Thread Ista Zahn
See the note in the help page for ?predict.glm Best, Ista On Tue, Jan 25, 2011 at 2:59 PM, Axel Urbiz wrote: > Dear List, > > I think I'm going crazy here...can anyone explain why do I get the same > predictions in train and test data sets below when the second has a missing > input? > > y <- rn

Re: [R] subsetting based on joint values of critera

2011-01-25 Thread Ista Zahn
Hi Simon, You almost had it! Just need to move the negation outside the rest of the logic, and remove the quotes from year. Not actually tested (no data), but I think newdata<- subset(bpa, !(State=="Connecticut" & year<2010)) should do it. Best, Ista On Tue, Jan 25, 2011 at 1:34 PM, Simon Kiss

[R] Predictions with 'missing' variables

2011-01-25 Thread Axel Urbiz
Dear List, I think I'm going crazy here...can anyone explain why do I get the same predictions in train and test data sets below when the second has a missing input? y <- rnorm(1000) x1 <- rnorm(1000) x2 <- rnorm(1000) train <- data.frame(y,x1,x2) test <- data.frame(x1) myfit <- glm(y ~ x1 + x2,

Re: [R] Importing xls from a http://

2011-01-25 Thread Gabor Grothendieck
On Tue, Jan 25, 2011 at 2:06 PM, cameron wrote: > > I know a lot of people asked similar questions like this.  I have tried using > > read.xls () > Error in .Call("ReadXls", file, colNames, sheet, type, from, rowNames,  : >  Incorrect number of arguments (11), expecting 10 for ReadXls > > read.tab

Re: [R] Counting number of rows with two criteria in dataframe

2011-01-25 Thread Ista Zahn
Hi Ryan, One option would be X$a <- paste(X$x, X$y, sep=".") table(X$a) Best, Ista On Tue, Jan 25, 2011 at 2:25 PM, Ryan Utz wrote: > Hi R-users, > > I'm trying to find an elegant way to count the number of rows in a dataframe > with a unique combination of 2 values in the dataframe. My data is

[R] Help with calculating correlation coefficient - creating a network

2011-01-25 Thread kparamas
Hi, I am creating a correlation based graph for the data 27 X 3040. I am not sure if I am allocating enough space for the data. I am using the following .R file (which is an example for geneData)! http://r.789695.n4.nabble.com/file/n3236801/sampleClimate.R sampleClimate.Rhttp://r.789695.n4.nabbl

[R] Does anybody knows the default value of starting value in glm?

2011-01-25 Thread Akram Khaleghei Ghosheh balagh
Hello ; Do you know what is the default value of starting value in glm ? glm(..., start=c(),... ) I know that it is NULL by default but it need a value to start iteration . what is this value? Thanks; [[alternative HTML version deleted]] __ R-

[R] Help Derivate for Nonlinear Growth Models

2011-01-25 Thread acocac
Hi!! Im doing my graduated work in Onion Curves Growth with Nonlinear Models, I'm amateur in R so i have doubt how i put or program next models, http://r.789695.n4.nabble.com/file/n3236748/96629508.png Also, i cant derivate for Gauss Model, and Richard Model dont have funtion, If someone could

[R] Importing xls from a http://

2011-01-25 Thread cameron
I know a lot of people asked similar questions like this. I have tried using read.xls () Error in .Call("ReadXls", file, colNames, sheet, type, from, rowNames, : Incorrect number of arguments (11), expecting 10 for ReadXls read.table or read.csv (Wrong table format) odbcConnectExcel have

[R] subsetting based on joint values of critera

2011-01-25 Thread Simon Kiss
Dear colleagues, I have a dataset that looks as below. I would like to make a new dataset that excludes the cases which are joint conjunctions of particular state names and years, so Connecticut and 2010, Maryland and 2010 and Vermont and 2010. I'm trying the following subset code: newdata<- s

Re: [R] Counting number of rows with two criteria in dataframe

2011-01-25 Thread Henrique Dallazuanna
If you want count: xtabs( ~ x + y, X) or sum: xtabs(z ~ x + y, X) On Tue, Jan 25, 2011 at 5:25 PM, Ryan Utz wrote: > Hi R-users, > > I'm trying to find an elegant way to count the number of rows in a > dataframe > with a unique combination of 2 values in the dataframe. My data is > specifi

[R] Counting number of rows with two criteria in dataframe

2011-01-25 Thread Ryan Utz
Hi R-users, I'm trying to find an elegant way to count the number of rows in a dataframe with a unique combination of 2 values in the dataframe. My data is specifically one column with a year, one with a month, and one with a day. I'm trying to count the number of days in each year/month combinati

[R] Warning with predict.glm method

2011-01-25 Thread Lars Bishop
Dear list, When I use the predict.glm method on a glm fitted object, I get the following warning message: In addition: Warning message: > In predict.lm(object, x) : > prediction from a rank-deficient fit may be misleading As the documentation says this happens if "the fit is rank-deficient, som

Re: [R] Extracting SSE from lm

2011-01-25 Thread Peter Ehlers
On 2011-01-25 08:08, Brian J Mingus wrote: Apologies for this simple question - Given the number of comparisons I need to do it has become somewhat laborious to compute the SSE manually. I first have to extract the coefficients, build the model and run the model on the data. So far I haven't fou

Re: [R] Extracting SSE from lm

2011-01-25 Thread Greg Snow
It is not clear what you are doing or why you are doing it. If you tell us your ultimate goal we may be able to help you find a way that does not require all the computing that you are doing. How do you get your coefficients? Are you using lm? Have you looked at the resid function? -- Gregor

Re: [R] ggplot - controlling point size

2011-01-25 Thread Gene Leynes
Thank you both, very much. Using the identity function I() is a very nice trick, but it still feels like a trick. Using ggplot makes the most sense to me. ggplot(df, aes(x=x, y=y, colour=factor(type))) + geom_point(size=1) + geom_smooth() Thank you very much for taking the time to

Re: [R] ggplot - controlling point size

2011-01-25 Thread Brian Diggs
On 1/25/2011 9:44 AM, Felipe Carrillo wrote: try this: qplot(x, y, data=df, colour=factor(type), size=I(1)) + geom_smooth() Felipe very nicely answered the "how" of your question. I thought I'd followup with the "why." Using qplot, it assumes that you are giving a set of aesthetic mappings.

Re: [R] crazy loop error.

2011-01-25 Thread Ivan Calandra
Now I understand what the difference between a primitive and a non-primitive! Thanks for the clarification! Ivan Le 1/25/2011 18:03, Bert Gunter a écrit : Well, I'm not Prof. Ripley, but the answer is: Look at the code. seq_len, seq.int, and seq_along call Primitives, which are implemented in C

[R] coxme and random factors

2011-01-25 Thread Sophie Armitage
Hi I would really appreciate some help with my code for coxme... My data set I'm interested in survival of animals after an experiment with 4 treatments, which was performed on males and females. I also have two random factors: Response variable: survival (death) Factor 1:

Re: [R] determining the order in which points are plotted

2011-01-25 Thread Greg Snow
With large numbers of points you might want to consider hexagonal binning instead of scatter plots. I don't know of any tools that both do the binning and take groups into account, but you could think it through and work something out. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center I

Re: [R] Train error:: subscript out of bonds

2011-01-25 Thread Neeti
after using options(error=utils::recover) option, following is the output. if i am correct this means that in ksvm there is some problem, but really could not understand. could anyone please tell me what is wrong... any help will be great thank you so much.. Enter a frame number, or 0 to

Re: [R] ggplot - controlling point size

2011-01-25 Thread Felipe Carrillo
try this: qplot(x, y, data=df, colour=factor(type), size=I(1)) + geom_smooth()   Felipe D. Carrillo Supervisory Fishery Biologist Department of the Interior US Fish & Wildlife Service California, USA http://www.fws.gov/redbluff/rbdd_jsmp.aspx - Original Message > From: Gene Leynes > T

[R] NA replacing

2011-01-25 Thread andrija djurovic
Hello R user, I have following data frame: df=data.frame(id=c(1:10),strata=rep(c(1,2),c(5,5)),y=c( 10,12,10,NA,15,70,NA,NA,55,100),x=c(3,4,5,7,4,10,12,8,3,15)) and I would like to replace NA's with: instead of first NA tapply(na.exclude(df)$y,na.exclude(df)$strata,sum)[1]* *7 */tapply(na.exclu

[R] Failing to install {rggobi} on win-7 R 2.12.0

2011-01-25 Thread Tal Galili
Greetings all, I am failing to install the package rggobi on windows 7 with R 2.12.0. On R 2.11.1, the package was installed fine. I asked for help on the rggobi google group 4 days ago, and didn't receive any help, so I was wondering if someone here might have a suggestion. Here are the details

[R] ggplot - controlling point size

2011-01-25 Thread Gene Leynes
Can anyone illuminate the following for me? How can I get rid of the blue line in the key in the second plot? ## Create a simple data frame df=data.frame(x=1:1000, y=2*1:1000+rnorm(1000,sd=1000), type=sample(letters[1:2],1000, replace=TRUE)) ## Very nice! Almost what I want qplot(x, y, d

Re: [R] Learn Vectorization (Vectorize)

2011-01-25 Thread Bert Gunter
Inline below. -- Bert On Tue, Jan 25, 2011 at 7:48 AM, Henrique Dallazuanna wrote: > Try this: > > expand.grid(seq(startpos, endpos, by = diff(c(startpos, endpos)) / > nrow(sr)), >          seq(startpos, endpos, by = diff(c(startpos, endpos)) / nrow(sr))) > > On Tue, Jan 25, 2011 at 1:29 PM, Ala

[R] Multivariate polynomials Howto

2011-01-25 Thread Alaios
Good Evening, I would like to work with multivariate polynomials (x and y variables). I know that there is a package called multipol but I am not sure that supports my needs. I use a function (in reality legendre.polynomials) which creates me the polynomials I want. For example the following ret

Re: [R] crazy loop error.

2011-01-25 Thread Bert Gunter
Well, I'm not Prof. Ripley, but the answer is: Look at the code. seq_len, seq.int, and seq_along call Primitives, which are implemented in C, and therefore MUCH faster than seq(), which is implemented as pure R code (and is also a generic, so requires method dispatch). Though for small n (up to a f

[R] applying a function to output a matrix

2011-01-25 Thread Lara Poplarski
Dear List, I am using function distCosine from package geosphere to a list of lat/lon coordinates, and I want to calculate the great circle distance between a pair of coordinates in the list and all other pairs --- essentially, the output should be a matrix. I have been able to achieve this with t

Re: [R] crazy loop error.

2011-01-25 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 25.01.2011 10:58:36: > ooh.. I have another question. > What if I want to add the value in the vector a to the hello each time it > prints. > Here is your output > > a <- c(2,3,5,5,5,6,6,7) > mapply(rep, "hello", rle(a)$lengths, USE.NAMES = FALSE) > >

[R] barplot with varaible-width bars

2011-01-25 Thread Gould, A. Lawrence
I would like to produce a bar plot with varying-width bars. Here is an example to illustrate: ww <- c(417,153,0.0216,0.0065,556,256,0.0162,0.0117, + 726,379,0.0358,0.0501,786,502,0.0496,0.0837, + 892,591,0.0785,0.0795) yy<-t(t(array(ww,c(2,10 barplot(yy[,2*1:5],las=1,space=c(.1,.5),beside

[R] deSolve: Problem solving ODE including modulo-operator

2011-01-25 Thread apokaly
I have a problem integrating the 'standard map' ( http://en.wikipedia.org/wiki/Standard_map http://en.wikipedia.org/wiki/Standard_map ) with deSolve: By using the modulo-operator '%%' with 2*pi in the ODEs (standardmap1), the resulting values of P and Theta, should not be greater than 2pi. Becaus

[R] Extracting SSE from lm

2011-01-25 Thread Brian J Mingus
Apologies for this simple question - Given the number of comparisons I need to do it has become somewhat laborious to compute the SSE manually. I first have to extract the coefficients, build the model and run the model on the data. So far I haven't found any method in R that will do this for me.

Re: [R] Learn Vectorization (Vectorize)

2011-01-25 Thread Henrique Dallazuanna
Try this: expand.grid(seq(startpos, endpos, by = diff(c(startpos, endpos)) / nrow(sr)), seq(startpos, endpos, by = diff(c(startpos, endpos)) / nrow(sr))) On Tue, Jan 25, 2011 at 1:29 PM, Alaios wrote: > Greetings Friends, > I would be grateful if you can help me undestand how to make

Re: [R] Paired data survival analysis

2011-01-25 Thread Terry Therneau
--- begin included message --- Im an honours student at Monash University. I'm trying to analyse some data for my project, which involved 2 treatments. My subjects were exposed to both treatments, and i gave them 60 minutes to perform a certain behaviour. 3 of my subjects performed the behaviour

[R] 3D Binning

2011-01-25 Thread vioravis
I am trying to do binning on three variables (3d binning). The bin boundaries are specified by the user separately for each variable. I used the bin2 function in the 'ash' package for 2d binning that involves only two variables but didn't any package for similar binning with three variables. Are t

[R] Problem with matchit() and zelig()

2011-01-25 Thread F.Giammarino
Dear all, Does anybody know why the following code returns an error message? >library(MatchIt) >library(Zelig) >data(lalonde) > >m.out1<-matchit(treat~age+educ+black+hispan+nodegree+married +re74+re75, method="full", data=lalonde) > >z.out1<-zelig(re78~age+educ+black+hispan+nodegree+married+re74+

Re: [R] crazy loop error.

2011-01-25 Thread Roy Mathew
ooh.. I have another question. What if I want to add the value in the vector a to the hello each time it prints. Here is your output a <- c(2,3,5,5,5,6,6,7) mapply(rep, "hello", rle(a)$lengths, USE.NAMES = FALSE) [[1]] [1] "hello" [[2]] [1] "hello" [[3]] [1] "hello" "hello" "hello" [[4]] [1] "

Re: [R] Train error:: subscript out of bonds

2011-01-25 Thread Neeti
Version: R = 2.11.1 CARET = 4.68 -- View this message in context: http://r.789695.n4.nabble.com/Train-error-subscript-out-of-bonds-tp3234510p3236251.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list ht

Re: [R] Downloading data from internet

2011-01-25 Thread Mike Marchywka
> From: ggrothendi...@gmail.com > Date: Mon, 24 Jan 2011 22:43:55 -0500 > To: megh700...@gmail.com > CC: r-help@r-project.org > Subject: Re: [R] Downloading data from internet > > On Mon, Jan 24, 2011 at 8:48 PM, Megh Dal wrote: > > Dear all, I need to download an excel file from net, on whi

[R] Learn Vectorization (Vectorize)

2011-01-25 Thread Alaios
Greetings Friends, I would be grateful if you can help me undestand how to make my R code more efficiently. I have read in R intoductory tutorial that a for loop is not used so ofter (and is not maybe not that efficient) compared to other languages. So I am trying to build understanding how to

Re: [R] Using open calais in R

2011-01-25 Thread Duncan Temple Lang
fayazvf wrote: > > I am using calais api in R for text analysis. > But im facing a some problem when fetching the rdf from the server. > I'm using the getToHost() method for the api call but i get just a null > string. You haven't told us nearly enough for us to be able to reproduce what you are

Re: [R] Integration of two lines

2011-01-25 Thread Xavier Robin
Le 25.01.2011 15:23, Rmh a écrit : > g <- function(x) abs(f1(x)-f2(x)) > > now you have one function and you can integrate it. Thank you Rich. Unfortunately I have no f1 and f2 functions, only a set of observed points on two lines - and no idea about the underlying distribution to create a funct

Re: [R] Integration of two lines

2011-01-25 Thread Hans W Borchers
Xavier Robin unige.ch> writes: > Hello, > > I need to integrate the absolute difference between two lines measured > on different points. > > # For example : > x <- seq(0, 1, 1/100) > f_x <- runif(101) + x > y <- seq(0, 1, 1/23) > f_y <- runif(24) + (1 - y) > > plot(x, f_x, type="l") > lines(y

Re: [R] Problem reading PostgreSQL data with RODBC

2011-01-25 Thread Albin Blaschka
Am 24.01.2011 14:08, schrieb Bart Joosen: I think this is a problem with quotes. If you look good, you see: seiz.df<- sqlFetch(chnl, 'source.MAIN') ... 'source.main': table not found on channel You asked "MAIN", but your db can't find "main". If you use seiz.df<- sqlFetch(chnl, '\"source\".\"

[R] xlsReadWrite 1.5.4 and xlsReadWritePro 1.6.4 released

2011-01-25 Thread Hans-Peter Suter
The xlsReadWrite[Pro] package allows to natively read and write Excel files (.xls) on the Win 32-bit platform. Changes: o fix bug with integer conversion (http://dev.swissr.org/issues/113) PROBLEM: values outside the integer range (i.e. 12345678901) didn't give an NA (and a warning

[R] How to simulate a variable Xt=Wit+0.5Wit-1 with

2011-01-25 Thread Millo Giovanni
Dear Carlos, please refrain from posting the same question umpteen times. Please consider that code is hard to read and people might not have the time to run your simulation etc. etc.. As I told you privately in response to your message on 18/1, > Re: generating correlated effects, I tried this

Re: [R] Integration of two lines

2011-01-25 Thread Rmh
g <- function(x) abs(f1(x)-f2(x)) now you have one function and you can integrate it. Rich Sent from my iPhone On Jan 25, 2011, at 7:32, Xavier Robin wrote: > Hello, > > I need to integrate the absolute difference between two lines measured > on different points. > > # For example : > x <-

Re: [R] Train error:: subscript out of bonds

2011-01-25 Thread Max Kuhn
What version of caret and R? We'll also need a reproducible example. On Mon, Jan 24, 2011 at 12:44 PM, Neeti wrote: > > Hi, > I am trying to construct a svmpoly model using the "caret" package (please > see code below). Using the same data, without changing any setting, I am > just changing the

Re: [R] Subtracting elements of data.frame

2011-01-25 Thread Henrique Dallazuanna
Try this: sweep(as.matrix(df), 2, as.matrix(df[1,])) On Tue, Jan 25, 2011 at 7:20 AM, Vincy Pyne wrote: > Dear R helpers > > I have a dataframe as > > df = data.frame(x = c(1, 14, 3, 21, 11), y = c(102, 500, 40, 101, 189)) > > > df >x y > 1 1 102 > 2 14 500 > 3 3 40 > 4 21 101 > 5 11 1

Re: [R] Subtracting elements of data.frame

2011-01-25 Thread Peter Ehlers
On 2011-01-25 01:20, Vincy Pyne wrote: Dear R helpers I have a dataframe as df = data.frame(x = c(1, 14, 3, 21, 11), y = c(102, 500, 40, 101, 189)) df x y 1 1 102 2 14 500 3 3 40 4 21 101 5 11 189 # Actually I am having dataframe having multiple columns. I am just giving an exampl

[R] Map an Area to another

2011-01-25 Thread Alaios
Dear All, I would like to ask you help with the following: Assume that I have an area of 36 cells (or sub-areas) sr<-matrix(data=seq(from=1,to=36),nrow=6,ncol=6,byrow=TRUE) > sr [,1] [,2] [,3] [,4] [,5] [,6] [1,]123456 [2,]789 10 11 12 [3,] 13 14

[R] Integration of two lines

2011-01-25 Thread Xavier Robin
Hello, I need to integrate the absolute difference between two lines measured on different points. # For example : x <- seq(0, 1, 1/100) f_x <- runif(101) + x y <- seq(0, 1, 1/23) f_y <- runif(24) + (1 - y) plot(x, f_x, type="l") lines(y, f_y) Then I would like to compute Integral( | f_x - f_y

Re: [R] how to get loglik parameter from splm package?

2011-01-25 Thread Millo Giovanni
Dear useR, although I admit that getting the log likelihood is important, you must concede that obtaining the parameter estimates is not bad either. Regarding "craze", well there are crazier things in the world than this, just look at the political situation in Italy. Anyway, the loglik has alway

Re: [R] Masking commands - Permutation in gregmisc and e1071

2011-01-25 Thread Uwe Ligges
On 24.01.2011 23:53, Peter Langfelder wrote: On Mon, Jan 24, 2011 at 2:47 PM, Yanika Borg wrote: I am using the function permutations from the package *gregmisc*. However, I am also making use of the package *e1071*, which also contains a function called permutations. I want to use the functi

  1   2   >