Re: [R] generating random samples of IG distribution

2012-08-29 Thread David Scott
I don't read R-help these days so have just seen this. Both generalized inverse Gaussian and normal inverse Gaussian are in GeneralizedHyperbolic. HyperbolicDist is no longer being maintained. David Scott On 12/06/2012 5:41 a.m., David L Carlson wrote: Should have been For the normal inve

Re: [R] creating lagged variable in panel data

2012-08-29 Thread Alok Bohara, PhD
Sorry, this is what I used : f <- function(x) { wage <- ts(x$wage, start = x$year[1]) idx <- seq(length = length(wage)) wages <- cbind(wage, wage.lag1 = lag(wage, -1))[idx,] cbind(x, wages) } result <- do.call("rbin

[R] Leading plus in numeric fields

2012-08-29 Thread Luca Meyer
Hello R experts, I have go this data frame: 'data.frame': 1 obs. of 20 variables: $ Anno : chr "PREVISIONI VS TARGET" $ OreTot: num 41 $ GioTot: logi NA $ OrGTot: logi NA $ OreCli: num 99 $ GioCli: logi NA $ OrGCli: logi NA $ OreFor: num -27 $ GioFor: logi NA $ OrGFor: logi NA $ Or

Re: [R] Bonferroni correction for multiple correlation tests

2012-08-29 Thread Mark Leeds
Hi: Bonferroni can be used for any hypothesis test or confidence interval where a statistic is calculated. The idea behind it is that, if a statistic is being calculated many times ( as in the case of say anova where multiple differences between groups can be calculated ), then the critical value u

Re: [R] Bonferroni correction for multiple correlation tests

2012-08-29 Thread Joshua Wiley
On Wed, Aug 29, 2012 at 6:48 PM, R. Michael Weylandt wrote: > On Wed, Aug 29, 2012 at 6:23 PM, Louise Cowpertwait > wrote: >> Please can someone advise me how I can adjust correlations using >> bonferroni's correction? I am doing manny correlation tests as part of an >> investigation of the val

Re: [R] Bonferroni correction for multiple correlation tests

2012-08-29 Thread Bert Gunter
Indeed... But it seems clear that, 1. This is off topic for this list. 2. Ms. Cowpertwait would be wise to seek the help of a local statistician. does it not? Cheers, Bert On Wed, Aug 29, 2012 at 6:48 PM, R. Michael Weylandt wrote: > On Wed, Aug 29, 2012 at 6:23 PM, Louise Cowpertwait > wrot

Re: [R] Bonferroni correction for multiple correlation tests

2012-08-29 Thread David Winsemius
On Aug 29, 2012, at 4:23 PM, Louise Cowpertwait wrote: Please can someone advise me how I can adjust correlations using bonferroni's correction? I am doing manny correlation tests as part of an investigation of the validity/reliability of a psychometric measure. Help would be so appreciat

Re: [R] latex \subfloat{} incompatible with sweave/knitr code

2012-08-29 Thread Duncan Mackay
Hi Yihui For figures in latex my bible is Keith Reckdahl Using Imported Graphics in LATEX and pdfLATEX Version 3.0.1 January 12, 2006 I think there is a 2009 version but I cannot find it Below is an example of a 3 X 1 figure \begin{figure}[h] \centering % Figure A \subfloat[A]{ \label{subfig:

Re: [R] predict.lm(...,type="terms") question

2012-08-29 Thread David Winsemius
On Aug 29, 2012, at 4:08 PM, John Thaden wrote: Draper & Smith sections (3.2, 9.6) address prediction interval issues, but I'm also concerned with the linear fit itself. The Model II regression literature Citations? makes it abundantly clear that OLS regression of x on y frequently yields

Re: [R] Problem installing Rmpi with Open MPI

2012-08-29 Thread Linh Tran
Thank you for the advice. I tried using the command, and it still wouldn't load. I tried uninstalling all of the MPI interfaces, reinstalled openmpi using the "--enabled-shared --disable-dlopen" command, and Rmpi was able to install sucessfully inside R. Thank you to Prof Ripley for pointing

Re: [R] Bonferroni correction for multiple correlation tests

2012-08-29 Thread R. Michael Weylandt
On Wed, Aug 29, 2012 at 6:23 PM, Louise Cowpertwait wrote: > Please can someone advise me how I can adjust correlations using bonferroni's > correction? I am doing manny correlation tests as part of an investigation of > the validity/reliability of a psychometric measure. > Help would be so appr

Re: [R] creating lagged variable in panel data

2012-08-29 Thread R. Michael Weylandt
On Wed, Aug 29, 2012 at 8:20 PM, Alok Bohara, PhD wrote: > Thanks for the input. I wanted to avoid counting the column number. In > any case, in the script -- wage.lag1 = lag(wage, -1) seems to do the trick. The important thing is that "4" in my example below can be any computable expression:

Re: [R] creating lagged variable in panel data

2012-08-29 Thread Alok Bohara, PhD
Thanks for the input. I wanted to avoid counting the column number. In any case, in the script -- wage.lag1 = lag(wage, -1) seems to do the trick. Alok On 8/29/2012 12:29 PM, R. Michael Weylandt wrote: Of course: colnames(dats)[4] <- "new name" M On Aug 29, 2012, at 9:34 AM, "Alok K

[R] Bonferroni correction for multiple correlation tests

2012-08-29 Thread Louise Cowpertwait
Please can someone advise me how I can adjust correlations using bonferroni's correction? I am doing manny correlation tests as part of an investigation of the validity/reliability of a psychometric measure. Help would be so appreciated! Cheers, Louise ___

Re: [R] predict.lm(...,type="terms") question

2012-08-29 Thread John Thaden
Draper & Smith sections (3.2, 9.6) address prediction interval issues, but I'm also concerned with the linear fit itself. The Model II regression literature makes it abundantly clear that OLS regression of x on y frequently yields a different line than of y on x. The example below is not so extreme

Re: [R] Extracting the name of a function (inverse of match.fun("myFun"))

2012-08-29 Thread Rolf Turner
On 30/08/12 10:36, Peter Langfelder wrote: Hi all, is there a way to extract the name of a function, i.e. do the reverse of match.fun applied to a character string? I would like to print out the name of a function supplied to another function as an argument. For example: myFunc = function(x) {

Re: [R] Extracting the name of a function (inverse of match.fun("myFun"))

2012-08-29 Thread Peter Langfelder
On Wed, Aug 29, 2012 at 4:14 PM, William Dunlap wrote: > deparse(substitute(fnc)) will get you part way there. ... > I like to let the user override what substitute might say by > making a new argument out of it: >> applyFunc(function(x)x*10, 1:3) > fnc is function(x) x * 10 > [1] 10 20 30 >> appl

Re: [R] Extracting the name of a function (inverse of match.fun("myFun"))

2012-08-29 Thread William Dunlap
deparse(substitute(fnc)) will get you part way there. myFunc <- function(x) x + 1 applyFunc <- function(fnc, x) { cat("fnc is", deparse(substitute(fnc)), "\n") fnc <- match.fun(fnc) fnc(x) } > applyFunc(myFunc, 1:3) fnc is myFunc [1] 2 3 4 > applyFunc(function(x)x*10, 1:3) fnc is func

Re: [R] Extracting the name of a function (inverse of match.fun("myFun"))

2012-08-29 Thread Eloi Mercier
On 12-08-29 04:00 PM, Peter Langfelder wrote: On Wed, Aug 29, 2012 at 3:36 PM, Peter Langfelder wrote: Hi all, is there a way to extract the name of a function, i.e. do the reverse of match.fun applied to a character string? I would like to print out the name of a function supplied to another

Re: [R] Deduping in R by multiple variables

2012-08-29 Thread William Dunlap
You can find out which rows of a data.frame called dataFrame are duplicates of previous rows with dups <- duplicated(dataFrame) To make a new data.frame without them do duplessDataFrame <- dataFrame[!dups, ] You could use unique(dataFrame), but, as in your examples, I think one often wants to

Re: [R] Extracting the name of a function (inverse of match.fun("myFun"))

2012-08-29 Thread Peter Langfelder
On Wed, Aug 29, 2012 at 3:36 PM, Peter Langfelder wrote: > Hi all, > > is there a way to extract the name of a function, i.e. do the reverse > of match.fun applied to a character string? I would like to print out > the name of a function supplied to another function as an argument. > > For example

Re: [R] latex \subfloat{} incompatible with sweave/knitr code

2012-08-29 Thread Yihui Xie
Do you know what environments are allowed inside \subfloat{}? The graphics example works because it is nothing but a simple \includegraphics{} command. The table example you gave is much more complicated than that. Regards, Yihui -- Yihui Xie Phone: 515-294-2465 Web: http://yihui.name Department

[R] Extracting the name of a function (inverse of match.fun("myFun"))

2012-08-29 Thread Peter Langfelder
Hi all, is there a way to extract the name of a function, i.e. do the reverse of match.fun applied to a character string? I would like to print out the name of a function supplied to another function as an argument. For example: myFunc = function(x) { x+1 } applyFunc = function(fnc, x) { fnc

[R] How do you learn/teach R?

2012-08-29 Thread Jonathan Cornelissen
Hi, I am conducting a survey on how people learn and teach R. I think the results of the survey could lead to interesting insights that could benefit the R community, and the educational practices in specific. The data and the results of the survey will be shared with everyone. Please help us

[R] Deduping in R by multiple variables

2012-08-29 Thread ramoss
I have a dataset w/ 184K obs & 16 variables. In SAS I proc sort nodupkey it in seconds by 11 variables. I tried to do the same thing in R using both the unique & then the !duplicated functions but it just hangs there & I get no output. Does anyone know how to solve this? This is how I tried to d

Re: [R] Problem installing Rmpi with Open MPI

2012-08-29 Thread Dirk Eddelbuettel
On 29 August 2012 at 11:37, Linh Tran wrote: | I've spent a few days trying to install Rmpi with no luck. I originally | tried using mpich, moved on to mpich2, and then to openmpi. I've gotten | the furthest with openmpi, though am still running into this problem and | can't figure it out. Can som

Re: [R] latex \subfloat{} incompatible with sweave/knitr code

2012-08-29 Thread Liviu Andronic
Hey Yihui On Wed, Aug 29, 2012 at 6:17 PM, Yihui Xie wrote: > Yes that is one possible solution, but the filename is hard-coded > somehow. The key to this problem is a missing new line before <<>>=, > which was addressed in > https://github.com/downloads/yihui/knitr/knitr-subfloats.pdf > Thanks

Re: [R] Problem Installing a Package

2012-08-29 Thread Milan Bouchet-Valat
Le mercredi 29 août 2012 à 14:12 -0400, Stephen P. Molnar a écrit : > I have just installed the latest version of R on a openSUSE 12.1 system > running on an ORacle VM VirtualBox and have encountered a problem with > installing ChemometricsWithR. Here is the output: > > > library("compiler") >

Re: [R] spatial correlation in lme and huge correlation matrix (memory limit)

2012-08-29 Thread Milan Bouchet-Valat
Le mercredi 29 août 2012 à 16:00 -0400, Sabrina Plante a écrit : > Hi, > > I'm trying to introduce a (spatial) exponential correlation > structure (with range=200 and nugget.effet of 0.3) in a lme model of > this form: lme(ARBUS~YEAR, random=~1|IDSOUS). > > The structure of the data is "IDS

Re: [R] Problem installing Rmpi with Open MPI

2012-08-29 Thread Prof Brian Ripley
As the posting guide asked, please discuss this with the maintainer. He knows about this. In short: Rmpi does not work if OpenMPI was compiled to dynamically load extensions, which is nowadays the default installation. If your OpenMPI is >= 1.5 (and for some installs of 1.4.x) you will need

[R] spatial correlation in lme and huge correlation matrix (memory limit)

2012-08-29 Thread Sabrina Plante
Hi, I'm trying to introduce a (spatial) exponential correlation structure (with range=200 and nugget.effet of 0.3) in a lme model of this form: lme(ARBUS~YEAR, random=~1|IDSOUS). The structure of the data is "IDSOUS" "XMIN" "YMAX" "YEAR" "ARBUS" with 2 years of data and 5600 points f

Re: [R] creating lagged variable in panel data

2012-08-29 Thread arun
HI, Try this: wage2.dat<-read.table(text="   year person   wage    lag(wage,-1)   1980  1 -0.75843997    NA   1981  1  0.27233048  -0.75843997   1982  1 -1.58335767    0.27233048   1983  1  0.36805926  -1.58335767   1984  1 -0.52312153    0.36805926   1980  2 -0.

[R] Problem Installing a Package

2012-08-29 Thread Stephen P. Molnar
I have just installed the latest version of R on a openSUSE 12.1 system running on an ORacle VM VirtualBox and have encountered a problem with installing ChemometricsWithR. Here is the output: > library("compiler") > install.packages("ChemometricsWithR") Installing package(s) into ‘/home/comput

Re: [R] Help on calculating spearman rank correlation for a data frame with conditions

2012-08-29 Thread Peter Ehlers
On 2012-08-29 08:45, S Ellison wrote: id price distance 1 2 4 1 35 ... 2 4 8 2 5 9 I would like to calculate the rank-order correlation between price and distance for each id. cor(price,distance,method = "spearman") calculate a correlation for all. Try by() #Example d <-

Re: [R] variable scope

2012-08-29 Thread Sam Steingold
> * Duncan Murdoch [2012-08-29 10:30:10 -0400]: > > On 29/08/2012 12:50 AM, Sam Steingold wrote: >> > * Duncan Murdoch [2012-08-28 21:06:33 -0400]: >> > >> > On 12-08-28 5:55 PM, Sam Steingold wrote: >> >> >> >> my observation is that gc in R sucks. >> >> (it cannot release small objects). >> >>

[R] wind maps

2012-08-29 Thread Liviu Andronic
Dear all I was wondering what old hacks on this list were thinking about the shiny new "wind map", which The Economist describes as " breathtaking for its elegance and rich data presentation". [1] What do you think of it? And of authors' other graphs? Can something similar be done in R? Regards L

Re: [R] limit on vector size allocation

2012-08-29 Thread David Winsemius
On Aug 29, 2012, at 10:23 AM, Siddeek, Shareef (DFG) wrote: Hi, Can someone help me on the following problem? I have nearly 103,000 records with 22 variables (some are factors). When I ran a stepwise glm on the data set, the R program stops with an error message Stepwise methods are st

Re: [R] predict.lm(...,type="terms") question

2012-08-29 Thread Rui Barradas
Hello, Ok, got it, thanks. Apparently I was right, the estimator is still x.pred = (y.new - b0)/b1 which can be obtained from predict.lm with the inverse regression model formula. According to the litterature, the main differences are in the confidence intervals for the true value of x.pred,

Re: [R] tapply confusion

2012-08-29 Thread David Winsemius
On Aug 29, 2012, at 7:37 AM, andyspeak wrote: Hello I have a huge data frame with three columns 'Roof' 'Month' and 'Temp' i want to run analyses on the numerical Temp data by the factors Roof and Month, separately and together. For using more than one factor i understand i should use aggrega

[R] Problem installing Rmpi with Open MPI

2012-08-29 Thread Linh Tran
Hi guys, I've spent a few days trying to install Rmpi with no luck. I originally tried using mpich, moved on to mpich2, and then to openmpi. I've gotten the furthest with openmpi, though am still running into this problem and can't figure it out. Can someone help!? Thanks so much in advanced. I'm

Re: [R] 2 (related) problems with RODBC in 64 bit Windows

2012-08-29 Thread R. Michael Weylandt
On Wed, Aug 29, 2012 at 1:32 PM, Ivan Alves wrote: > Dear Uwe, > Many thanks for the reply. > On 1, the problem is that RODBC on 32 bit ' interprets' factors correctly, > whereas on 64 bit it gives the error below. On both systems forcing > characters (via colClasses = "character" in read.csv)

Re: [R] predict.lm(...,type="terms") question

2012-08-29 Thread David Winsemius
On Aug 29, 2012, at 8:06 AM, John Thaden wrote: Could it be that my newdata object needs to include a column for the concn term even though I'm asking for concn to be predicted? The new data argument MUST contain a column with the name "area". If it does not hten the original data is used.

Re: [R] 2 (related) problems with RODBC in 64 bit Windows

2012-08-29 Thread Ivan Alves
Dear Uwe, Many thanks for the reply. On 1, the problem is that RODBC on 32 bit ' interprets' factors correctly, whereas on 64 bit it gives the error below. On both systems forcing characters (via colClasses = "character" in read.csv), results in no problems. I still see this as a problem of i

Re: [R] creating lagged variable in panel data

2012-08-29 Thread R. Michael Weylandt
Of course: colnames(dats)[4] <- "new name" M On Aug 29, 2012, at 9:34 AM, "Alok K Bohara, PhD" wrote: > Hi > > I found an example in R to create a lagged panel data set which works fine. > The only problem is that it adds the lagged variable as follows > > wage2.dat > > year pers

Re: [R] tapply confusion

2012-08-29 Thread Milan Bouchet-Valat
Le mercredi 29 août 2012 à 07:37 -0700, andyspeak a écrit : > Hello > I have a huge data frame with three columns 'Roof' 'Month' and 'Temp' > i want to run analyses on the numerical Temp data by the factors Roof and > Month, separately and together. > For using more than one factor i understand i s

Re: [R] Help on not matching object lengths

2012-08-29 Thread William Dunlap
> y <-matrix(1:50,ncol=5) > x <- rowSums(y > 13) # sum of logicals counts number of TRUEs > x # your first 'x': [1] 3 3 3 4 4 4 4 4 4 4 > sum(0.25 * x > 0.8) # sum of logicals counts number of TRUEs [1] 7 Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com > -Original Message- > From

Re: [R] Help on not matching object lengths

2012-08-29 Thread Andras Farkas
Petr,   thank you very much for the help, I think this will work... It seems like this will generate 33 columns and 1000 rows with calculated values, which is fine. I also simply used the function x=d + dnext, which generated another 33 columns and 1000 rows object with the cell contents added u

Re: [R] Sorting of columns of a matrix

2012-08-29 Thread arun
HI, I guess this might be what you want. dat1<-structure(c(0.585528817843856, 0.709466017509524, 0, -0.453497173462763, 0.605887455840393, -1.81795596770373, 0.630098551068391, -0.276184105225216, -0.284159743943371, -0.919322002474128, -0.116247806352002, 1.81731204370422, 0.370627864257954, 0.520

Re: [R] Sorting of columns of a matrix

2012-08-29 Thread arun
HI, Not sure I understand the last part. Try this: dat1<-structure(c(0.585528817843856, 0.709466017509524, 0, -0.453497173462763, 0.605887455840393, -1.81795596770373, 0.630098551068391, -0.276184105225216, -0.284159743943371, -0.919322002474128, -0.116247806352002, 1.81731204370422, 0.370627864257

Re: [R] Sorting of columns of a matrix

2012-08-29 Thread Nico Met
Yes, each column shall have different sequence of row names N On Wed, Aug 29, 2012 at 5:21 PM, PIKAL Petr wrote: > Hi > > ** ** > > But in your example there are no row names? How would you structure the > result? Each column has different order and therefore each column shall > have di

Re: [R] predict.lm(...,type="terms") question

2012-08-29 Thread John Thaden
Could it be that my newdata object needs to include a column for the concn term even though I'm asking for concn to be predicted? If so, what numbers would I fill it with? Or should my newdata object include the original data, too? Is there another mailing list I can ask? Thanks, -John On Wed, Aug

Re: [R] Sorting of columns of a matrix

2012-08-29 Thread PIKAL Petr
Hi > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Nico Met > Sent: Wednesday, August 29, 2012 4:25 PM > To: Berend Hasselman > Cc: r-help@r-project.org > Subject: Re: [R] Sorting of columns of a matrix > > Please find the

[R] tapply confusion

2012-08-29 Thread andyspeak
Hello I have a huge data frame with three columns 'Roof' 'Month' and 'Temp' i want to run analyses on the numerical Temp data by the factors Roof and Month, separately and together. For using more than one factor i understand i should use aggregate, but i am struggling with the tapply for single fa

Re: [R] predict.lm(...,type="terms") question

2012-08-29 Thread Peter Ehlers
I think that what the OP is looking for comes under the heading of "inverse regression" or the "calibration" problem. One reference with a simple explanation including confidence intervals is "Applied regression analysis" by Draper and Smith. (It's in section 3.2 in my 3rd edition). Peter Ehlers

[R] creating lagged variable in panel data

2012-08-29 Thread Alok K Bohara, PhD
Hi I found an example in R to create a lagged panel data set which works fine. The only problem is that it adds the lagged variable as follows wage2.dat year personwagelag(wage, -1) 1.1 1980 1 -0.75843997NA 1.2 1981 1 0.27233048 -0.7584399

Re: [R] predict.lm(...,type="terms") question

2012-08-29 Thread John Thaden
I think I may be misreading the help pages, too, but misreading how? I agree that inverting the fitted model is simpler, but I worry that I'm misusing ordinary least squares regression by treating my response, with its error distribution, as a predictor with no such error. In practice, with my rea

[R] limit on vector size allocation

2012-08-29 Thread Siddeek, Shareef (DFG)
  Hi, Can someone help me on the following problem? I have nearly 103,000 records with 22 variables (some are factors). When I ran a stepwise glm on the data set, the R program stops with an error message "Error: cannot allocate vector of size 171.3Mb." I have an R 2.12.0 on my PC (Windows XP)

Re: [R] Sorting of columns of a matrix

2012-08-29 Thread PIKAL Petr
Hi From: Nico Met [mailto:nicome...@gmail.com] Sent: Wednesday, August 29, 2012 5:27 PM To: PIKAL Petr Cc: r-help Subject: Re: [R] Sorting of columns of a matrix Yes, each column shall have different sequence of row names And what? I do not understand? You still did not describe how do you want

[R] transform RTs

2012-08-29 Thread Katja Böer
Hello, I'm trying to transform reaction times which are not normally distributed to an ex gaussian or an inverse gaussian distribution, but I don't really know how to use the exGAUS() function. Can someone show me a script in which data has been transformed? Thanks in advance k [[alter

Re: [R] predict.lm(...,type="terms") question

2012-08-29 Thread Rui Barradas
Hello, Inline. Em 29-08-2012 16:06, John Thaden escreveu: Could it be that my newdata object needs to include a column for the concn term even though I'm asking for concn to be predicted? If so, what numbers would I fill it with? Or should my newdata object include the original data, too? Is the

Re: [R] predict.lm(...,type="terms") question

2012-08-29 Thread Rui Barradas
Hello, predict(..., type = "terms") returns the predicted regressors multiplied by the respective beta centered. The centering constant is also returned: model <- lm(area ~ concn, data) # Already run predict(model, type = "terms") concn 1 -11542.321 2 -8244.515 3 1648.903 4 18137.9

Re: [R] PHP escapeshellcmd() equivalent

2012-08-29 Thread Yihui Xie
Well, then I guess there is no such function in base R, but it should be something like escapeshellcmd = function(x) gsub('[metacharacters]', '\\1', x) Regards, Yihui -- Yihui Xie Phone: 515-294-2465 Web: http://yihui.name Department of Statistics, Iowa State University 2215 Snedecor Hall, Am

Re: [R] R CMD build error with data files

2012-08-29 Thread Uwe Ligges
Christian, my late answer on this one: On 21.08.2012 22:28, Christian Hennig wrote: Dear list, I want to update my prabclus package which I haven't done for quite a while. In the previous version, I had .dat files in my data subdirectory, which I read using .R files. Now R CMD check gives me

Re: [R] latex \subfloat{} incompatible with sweave/knitr code

2012-08-29 Thread Yihui Xie
Yes that is one possible solution, but the filename is hard-coded somehow. The key to this problem is a missing new line before <<>>=, which was addressed in https://github.com/downloads/yihui/knitr/knitr-subfloats.pdf The LyX and Rnw source files can be checked out with GIT under https://github.c

Re: [R] PHP escapeshellcmd() equivalent

2012-08-29 Thread Roebuck,Paul L
On 8/24/12 9:59 PM, "Yihui Xie" wrote: > On Fri, Aug 24, 2012 at 3:17 PM, Roebuck,Paul L > wrote: >> On 8/24/12 2:59 PM, "R. Michael Weylandt" >> wrote: >> >>> On Fri, Aug 24, 2012 at 2:48 PM, Roebuck,Paul >>> wrote: [Redirected from R-Devel...] Not that I recall running acros

Re: [R] Help on calculating spearman rank correlation for a data frame with conditions

2012-08-29 Thread S Ellison
> id price distance > 1 2 4 > 1 35 > ... > 2 4 8 > 2 5 9 > I would like to calculate the rank-order correlation between > price and distance for each id. > > cor(price,distance,method = "spearman") calculate a > correlation for all. > Try by() #Example d <- data.frame(g=gl

Re: [R] K-Means clustering Algorithm

2012-08-29 Thread David L Carlson
It depends very much on what you consider "a small amount of error." Unless you specify starting centroids, K-means does not necessarily produce a unique partition for a particular data set unless you specify the starting seeds. In other words, you can get different results using Matlab's kmeans al

Re: [R] Sorting of columns of a matrix

2012-08-29 Thread PIKAL Petr
Hi But in your example there are no row names? How would you structure the result? Each column has different order and therefore each column shall have different sequence of row names? Send also your responses to r-help as somebody could have better answer for you. Regards Petr From: Nico M

Re: [R] Help on not matching object lengths

2012-08-29 Thread PIKAL Petr
Hi I am not sure if I understand it correctly but maybe a <-seq(0,8, by = sign(8-0)*0.25) b <-seq(8,16, by = sign(16-8)*0.25) const <-runif(1000,50,60) const <- rep(const, 33) d <-exp(-const*a)+exp(-const*b) dim(d) <- c(33,1000) gives you matrix 33x1000 Maybe you can simplyfy the example to 10 c

Re: [R] Estimation parameters of lognormal censored data

2012-08-29 Thread R. Michael Weylandt
Salma, I don't know much about survival modelling, but many smart folks do, so I'm forwarding this back to R-help so it gets a wider audience. In fact, we generally like to keep replies "on list" 1) so that they are archived for future googlers; 2) so that you have access to a wider pool of respon

Re: [R] variable scope

2012-08-29 Thread Duncan Murdoch
On 29/08/2012 12:50 AM, Sam Steingold wrote: > * Duncan Murdoch [2012-08-28 21:06:33 -0400]: > > On 12-08-28 5:55 PM, Sam Steingold wrote: >>> * R. Michael Weylandt [2012-08-28 13:45:35 -0500]: >>> always you shouldn't need manual garbage collection. >> >> my observation is that gc in R s

Re: [R] don't print object attributes

2012-08-29 Thread R. Michael Weylandt
On Wed, Aug 29, 2012 at 4:23 AM, Liviu Andronic wrote: > On Tue, Aug 28, 2012 at 9:05 PM, Duncan Murdoch > wrote: >> On 28/08/2012 2:16 PM, Liviu Andronic wrote: >>> I came up with a modified version of the above: >>> print_noattr <- function(x, keep.some=T, ...){ >>> if(keep.some) xa <- att

Re: [R] Sorting of columns of a matrix

2012-08-29 Thread Nico Met
Please find the require info: set.seed(12345) X<-matrix(rnorm(5*10),nrow=5) dim(X) X [,1] [,2][,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 1.2774431 -1.2427735 0.81933548 -2.1098586 -1.6726799 -2.2994684 -0.28823228 0.192930

Re: [R] mach_override.c

2012-08-29 Thread R. Michael Weylandt
On Wed, Aug 29, 2012 at 7:45 AM, Keith Weintraub wrote: > Folks, > I just upgraded my Mac to Mountain Lion and on running R.app I get the > following message: > > mach_override: some instructions unknown! Need to update mach_override.c > err = f801 > /Volumes/Haxdisk/Projects/DefaultFolderX

Re: [R] Error message

2012-08-29 Thread R. Michael Weylandt
On Wed, Aug 29, 2012 at 8:11 AM, Scott Raynaud wrote: > Here's the info Michael Weylandt requested: > >> installed.packages()[c("lme4","nlme","Matrix"),c(2,3,12)] >LibPath Version Built > lme4 "/usr/lib/R/site-library" "0.999375-40" "2.13.1" > nlme "/usr/lib/R/l

Re: [R] Sorting of columns of a matrix

2012-08-29 Thread Berend Hasselman
On 29-08-2012, at 16:08, Nico Met wrote: > Hello john, > > thanks for the suggestion. Please find an example: > >> X<-matrix(rnorm(5*10),nrow=5) > >> dim(X) > [1] 5 10 >> X > [,1] [,2][,3] [,4] [,5] [,6] > [,7] [,8] [,9] [,10] > [1,

Re: [R] Sorting of columns of a matrix

2012-08-29 Thread Nico Met
Hello john, thanks for the suggestion. Please find an example: > X<-matrix(rnorm(5*10),nrow=5) > dim(X) [1] 5 10 > X [,1] [,2][,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 1.2774431 -1.2427735 0.81933548 -2.1098586 -1.6726799 -2.2

Re: [R] define subset argument for function lm as variable?

2012-08-29 Thread Milan Bouchet-Valat
Le mercredi 29 août 2012 à 14:26 +0200, Milan Bouchet-Valat a écrit : > Le mercredi 29 août 2012 à 04:01 -0700, Joshua Wiley a écrit : > > On Wed, Aug 29, 2012 at 3:56 AM, Milan Bouchet-Valat > > wrote: > > > Le mardi 21 août 2012 à 07:51 -0700, Joshua Wiley a écrit : > > >> Hi Rainer, > > >> > >

Re: [R] Error message

2012-08-29 Thread Scott Raynaud
Here's the info Michael Weylandt requested: > installed.packages()[c("lme4","nlme","Matrix"),c(2,3,12)]    LibPath   Version   Built   lme4   "/usr/lib/R/site-library" "0.999375-40" "2.13.1" nlme   "/usr/lib/R/library"  "3.1-104" "2.15.0" Matrix "/usr/lib/R/library

Re: [R] write.matrix.csr data conversion

2012-08-29 Thread David Meyer
Yes, it seems that Prof Meyer hasn't pushed the changes to R forge yet. I now did. (There are no other repositories). David __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www

[R] Help on not matching object lengths

2012-08-29 Thread Andras Farkas
Dear All   I have the following code set up: Code #1 a <-matrix(seq(0,8, by = sign(8-0)*0.25)) b <-matrix(seq(8,16, by = sign(16-8)*0.25)) c <-runif(1000,50,60) d <-exp(-c*a)+exp(-c*b)   This will give me the obvious error message of lengths not matching. What I am trying to do here is to have 33

Re: [R] barchart with 3 rows

2012-08-29 Thread Geophagus
Thank you - I'll try it today and give you a reply!! Thanks a lot Geo -- View this message in context: http://r.789695.n4.nabble.com/barchart-with-3-rows-tp4641572p4641697.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-pr

Re: [R] Sorting of columns of a matrix

2012-08-29 Thread John Kane
Perhaps you could supply the matrix using dput() ? It is a handy way to supply sample data. Just do dput(mydata), copy the results and paste into email. At the moment your matrix is almost unreadable. John Kane Kingston ON Canada > -Original Message- > From: nicome...@gmail.com > Sen

[R] Sorting of columns of a matrix

2012-08-29 Thread Nico Met
Dear all, Please suggest me how can I do it. I have a matrix which look like following: x1 x2 x3 t1 .01 0.3 0 t2 0 0.1 0.01 t3 0 .01 .01 t4 0 0 t5 5 0 0 t6 0 0 0 t7 0 0 0 t8 0 0 0 t9 0.6 0 0 t10 0 0 0.66 t11 0 0.6 0.11 t12 0 0.4 0 I want to sort decreasing order in each column ba

Re: [R] 2 (related) problems with RODBC in 64 bit Windows

2012-08-29 Thread Uwe Ligges
On 24.08.2012 21:53, Ivan Alves wrote: Hi all, I am encountering an RODBC problem in R 2.15.1 in windows 64 bit which I do not encountered in the same set up in windows 32 bit (the latest binary version of RODBC in both cases from the same depository gotten by install.packages(‘RODBC’), Ora

Re: [R] interpret the importance output?

2012-08-29 Thread Liaw, Andy
The "type=1" importance measure in RF compares the prediction error of each tree on the OOB data with the prediction error of the same tree on the OOB data with the values of one variable randomly shuffled. If the variable has no predictive power, then the two should be very close, and there's

[R] mach_override.c

2012-08-29 Thread Keith Weintraub
Folks, I just upgraded my Mac to Mountain Lion and on running R.app I get the following message: mach_override: some instructions unknown! Need to update mach_override.c err = f801 /Volumes/Haxdisk/Projects/DefaultFolderX/DFCarbonPatch/../../Libraries/mach_star-1.2-intel-0.3/mach_override/m

Re: [R] date in plot, can't add regression line

2012-08-29 Thread Norbert Skalski
Thanks for your suggestions, The solution was as proposed by Mr. Nordlund, I had to convert the timestamps again using as.POSIXct() I will have to remember that anytime I do any kind of filtering/subselection of dates to reconvert them. Lesson learned. Also thank you for the dput() suggestio

Re: [R] define subset argument for function lm as variable?

2012-08-29 Thread Milan Bouchet-Valat
Le mercredi 29 août 2012 à 04:01 -0700, Joshua Wiley a écrit : > On Wed, Aug 29, 2012 at 3:56 AM, Milan Bouchet-Valat > wrote: > > Le mardi 21 août 2012 à 07:51 -0700, Joshua Wiley a écrit : > >> Hi Rainer, > >> > >> You could try: > >> > >> subs <- expression(dead==FALSE & recTreat==FALSE) > >>

Re: [R] predict.lm(...,type="terms") question

2012-08-29 Thread Rui Barradas
Hello, You seem to be misreading the help pages for lm and predict.lm, argument 'terms'. A much simpler way of solving your problem should be to invert the fitted model using lm(): model <- lm(area ~ concn, data) # Your original model inv.model <- lm(concn ~ area, data = data) # Your probl

Re: [R] latex \subfloat{} incompatible with sweave/knitr code

2012-08-29 Thread Liviu Andronic
On Wed, Aug 29, 2012 at 1:34 PM, Steve Lianoglou wrote: > This isn't exactly what you want, but I'm using kintr and building and > saving my figures in the their own "chunks" then just inlining the > path to the generated figure in the \subloat{..}. Things are working > fine, eg. my default settin

Re: [R] latex \subfloat{} incompatible with sweave/knitr code

2012-08-29 Thread Steve Lianoglou
Hi, On Wed, Aug 29, 2012 at 6:56 AM, Liviu Andronic wrote: > Dear all > Are LaTeX \subfloat{} commands incompatible with Sweave code? I cannot > get the following code to compile properly: > \begin{table} > \subfloat[asdfa]{<<>>= > 2+2 > @ > > } > > \caption{asdf} > > \end{table} > > > If I repla

Re: [R] Search for locations of subsequences?

2012-08-29 Thread Rui Barradas
Hello, Function Biostrings::matchPattern can be called with an algorithm = "boyer-moore" argument. I've never used it, this is the return value of library(sos) r1 <- findFn('boyer') r2 <- findFn('moore') r1 & r2 I have implemented the Boyer-Moore algorithm a couple of times, the first(!) of

Re: [R] define subset argument for function lm as variable?

2012-08-29 Thread Joshua Wiley
On Wed, Aug 29, 2012 at 3:56 AM, Milan Bouchet-Valat wrote: > Le mardi 21 août 2012 à 07:51 -0700, Joshua Wiley a écrit : >> Hi Rainer, >> >> You could try: >> >> subs <- expression(dead==FALSE & recTreat==FALSE) >> >> lme(formula, subset = eval(subs)) >> >> Not tested, but something along those l

Re: [R] define subset argument for function lm as variable?

2012-08-29 Thread Milan Bouchet-Valat
Le mardi 21 août 2012 à 07:51 -0700, Joshua Wiley a écrit : > Hi Rainer, > > You could try: > > subs <- expression(dead==FALSE & recTreat==FALSE) > > lme(formula, subset = eval(subs)) > > Not tested, but something along those lines should work. Out of curiosity, why isn't "subset" (and "weights

[R] latex \subfloat{} incompatible with sweave/knitr code

2012-08-29 Thread Liviu Andronic
Dear all Are LaTeX \subfloat{} commands incompatible with Sweave code? I cannot get the following code to compile properly: \begin{table} \subfloat[asdfa]{<<>>= 2+2 @ } \caption{asdf} \end{table} If I replace the Sweave chunk with a random string or a table, the compilation works fine. Any ide

Re: [R] barchart with 3 Arguments

2012-08-29 Thread Jim Lemon
On 08/29/2012 01:05 AM, Geophagus wrote: Hi @ all, I have a problem concerning the barplot (barchart lattice) of a dataframe. I work with the attached dataframe. When I try to plot this dataframe I only get two rows plottet. When I try to plot the whole dataframe, there is message, that it is 'h

Re: [R] don't print object attributes

2012-08-29 Thread Liviu Andronic
On Tue, Aug 28, 2012 at 9:05 PM, Duncan Murdoch wrote: > On 28/08/2012 2:16 PM, Liviu Andronic wrote: >> I came up with a modified version of the above: >> print_noattr <- function(x, keep.some=T, ...){ >> if(keep.some) xa <- attributes(x)[c('names', 'row.names', 'class')] >> attributes(