Re: [R] Error on easy way for JoSAE Package

2012-05-16 Thread ana24maria
Thank you very much. After using dput and the easy way ( result - eblup.mse.f.wrap(domain.data = amigo, lme.obj = fit.lme)), i have got the following error: Error in `[.data.frame`(sample.data, , variabs) : undefined columns selected What should I do? -- View this message in context:

[R] code to iterate function apply to matrix

2012-05-16 Thread umai88
I got this code below and i want to repeat the loop for 100 times.. x-rnorm(60) mat1-matrix(x,nrow=15,ncol=4) trim-numeric(ncol(mat1)) win-numeric(ncol(mat1)) ssd-numeric(ncol(mat1)) for(j in 1:ncol(mat1)) { n=length(mat1[,j]) alpha=0.1 k=floor(alpha*n)+1 r=k-(alpha*n) i=k+1 m=n-k

Re: [R] Regression Analysis or Anova?

2012-05-16 Thread Robert Latest
Hello Andrea, I don't know if I can help you (probably not, I'm a beginner myself), but you that you should make it a lot easier for those that can if you post a self-contained script in this forum that shows what you're trying to do. Use dput() to dump your dataset in text form. Good luck,

[R] order a data frame by date with order

2012-05-16 Thread Benedikt Gehr
Hi I have a rather large data frame (7000 rows with 28 columns) which I want to sort by date. Below I have a example of the data frame. The Date column is called DT, is a factor and looks like this: class(res.merge$DT) [1] factor head(res.merge$DT) [1] 17.3.2012 13:54:02 17.3.2012 14:00:07

[R] Help needed for efficient way to loop through rows and columns

2012-05-16 Thread Priya Bhatt
Dear R-helpers: I am trying to write a script that iterates through a dataframe that looks like this: Example dataset called sample: names - c(S1, S2, S3, S4) X - c(BB, AB, AB, AA) Y - c(BB, BB, AB, AA) Z - c(BB, BB, AB, NA) AorB - c(A, A, A, B) sample - data.frame(names, X, Y, Z, AorB) for

[R] Wrong Q3 + Mean.

2012-05-16 Thread Retep32
Hi. a [1] 13 13 14 14 15 15 16 20 21 26 summary(a) Min. 1st Qu. MedianMean 3rd Qu.Max. 13.014.015.016.719.026.0 mean(a) [1] 16.7 quantile(a) 0% 25% 50% 75% 100% 13 14 15 19 26 Clearly, this is not right. My Instructor and I have no idea

Re: [R] Wrong Q3 + Mean.

2012-05-16 Thread Joshua Wiley
On Wed, May 16, 2012 at 12:22 AM, Retep32 retepdel...@web.de wrote: Hi. a  [1] 13 13 14 14 15 15 16 20 21 26 summary(a)   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.   13.0    14.0    15.0    16.7    19.0    26.0 mean(a) [1] 16.7 quantile(a)  0%  25%  50%  75% 100%  13   14   15   19  

Re: [R] order a data frame by date with orderl

2012-05-16 Thread Jim Holtman
Is the a daylight saving time problem? Check your timezone and see when it occurred; these times might not be legal. Sent from my iPad On May 16, 2012, at 3:27, Benedikt Gehr benedikt.g...@ieu.uzh.ch wrote: Hi I have a rather large data frame (7000 rows with 28 columns) which I want to

[R] Change the order of variables in a linear model

2012-05-16 Thread Frank Paetzold
Hello, the following lines m - matrix(c(1,1,9,1,2,6,1,3,7,2,1,4,2,2,5,2,3,1,3,1,2,3,2,-1,3,3,-2), 9, 3, byrow = TRUE, dimnames=list(NULL, cbind('A','B','Y'))) md - as.data.frame(m) md$A - as.factor(md$A) md$B - as.factor(md$B) mm - model.matrix(Y~A+B+A:B, data=md) produce mm (Intercept)

[R] correlation among variables in the same subset

2012-05-16 Thread Andrea Sica
Dear all, I have created a subset from my dataset, which contains 6 variables. I need to make the correlation among all of them, possibly, without making it one by one. Is there any command that can permits me to do it directly for all of them in the same time? Thank you so much in advance.

Re: [R] Wrong Q3 + Mean.

2012-05-16 Thread Michael Dewey
At 08:22 16/05/2012, Retep32 wrote: Hi. a [1] 13 13 14 14 15 15 16 20 21 26 summary(a) Min. 1st Qu. MedianMean 3rd Qu.Max. 13.014.015.016.719.026.0 mean(a) [1] 16.7 quantile(a) 0% 25% 50% 75% 100% 13 14 15 19 26 Clearly, this is not right.

[R] tm package: problem of TermDocumentMatrix and minWordLength

2012-05-16 Thread C.H.
Dear All, The following code illustrate the problem. [R code] require(tm) exampledoc - c(R is good, R is really good) examplecorpus - Corpus(VectorSource(exampledoc), encoding = UTF-8) dtm - DocumentTermMatrix(examplecorpus, control = list(minWordLength = 1)) as.matrix(dtm) [/R code] The term R

Re: [R] confidence intervals for nls or nls2 model

2012-05-16 Thread Gabor Grothendieck
On Tue, May 15, 2012 at 11:20 PM, Gabor Grothendieck ggrothendi...@gmail.com wrote: On Tue, May 15, 2012 at 8:08 PM, Francisco Mora Ardila fm...@oikos.unam.mx wrote: Hi all I have fitted a model usinf nls function to these data: x  [1]   1   0   0   4   3   5  12  10  12 100 100 100 y  

Re: [R] Splus equivalent of reshape in R

2012-05-16 Thread Jim Lemon
On 05/16/2012 01:18 PM, Santosh wrote: Hello R/Splus users.. I am posting in R discussion group in hope of wider response compared to what I received from Splus user groups Was wondering if there is any function available in Splus 8.2 that is equivalent to reshape of R? Below is a sample

Re: [R] order a data frame by date with orderl

2012-05-16 Thread Benedikt Gehr
Hi, many thanks for your answer. if i set tz=GMT it does the job. Great! thanks cheers Benedikt Am 16.05.2012 12:20, schrieb jholtman [via R]: Is the a daylight saving time problem? Check your timezone and see when it occurred; these times might not be legal. Sent from my iPad On May

Re: [R] How to sum and group data by DATE in data frame

2012-05-16 Thread Cren
Michael Weylandt wrote Can you provide a reproducible example? Of course, Michael. Consider the following time series: 11/2/2011 14:30 123.53 11/2/2011 15:00 123.78 11/2/2011 15:30 124.24 11/2/2011 16:00 124.2 11/2/2011 16:30 124.07 11/2/2011 17:00 123.91 11/2/2011 17:30 123.44 11/2/2011

[R] Re : Wrong Q3 + Mean.

2012-05-16 Thread Pascal Oettli
Hi, Probably you could check this: ?quantile Particularly the 'type' option. Best Regards, Pascal - Mail original - De : Retep32 retepdel...@web.de À : r-help@r-project.org Cc : Envoyé le : Mercredi 16 mai 2012 16h22 Objet : [R] Wrong Q3 + Mean. Hi. a [1] 13 13 14 14 15 15 16 20

[R] finding mean and SD for a log-normal distribution

2012-05-16 Thread Andras Farkas
Dear R Expert   allow me to ask a quick qestion: I have a mean value of 6 and a SD of 3 describing my distribution. I would like to convert this distribution into a log normal distribution that would best describe it when resimulated using log normal distribution. Currently I am using another

Re: [R] write data using xlsReadWrite

2012-05-16 Thread diyanah
Hai, I have change it to these, but error and I couldn't fix it. Do you have any idea why? file - system.file(D:\\FYP\\image\\Cropped Images\\user61, forgerUser61.xlsx, package = xlsx) wb - loadWorkbook(forgerUser61.xlsx) sheets - getSheets(wb) sheet - sheets[[all]] res - readRows(sheet,

Re: [R] problem with get() inside of lme()

2012-05-16 Thread ONKELINX, Thierry
You can achieve that with a combination of as.formula and paste. library(nlme) data(petrol, package = MASS) lme(as.formula(paste(Y.VAR, ~EP)), random= ~1|No, data=petrol) Best regards, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and

[R] ANCOVA power

2012-05-16 Thread Xan
Dear list members: I am trying to calculate power for an ANCOVA analysis. I have found different solutions such as power.t.test and power.anova.test but they seem to refer to the ANOVA part of the ANCOVA. My model is of the form: lm (y ~ factor + x1 + x2 + x2*myfactor) where myfactor is a

Re: [R] Problem to resolve a step for reading a large TXT and, split in several file

2012-05-16 Thread Rui Barradas
Hello, Your bug is obvious, each pass through the loop you read twice and write only once. The file pointer keeps moving forward... Use something like while (length(pv - readLines(con, n=n)) 0 ) { # note that this line changed. i - i + 1 write.table(pv, file =

Re: [R] Automating R for Hypothesis Testing

2012-05-16 Thread meredith
Rui- Just a quick question. I understand your comment on using ANOVA, but doesn't this only test for similarities of the mean. We are trying to see if a the same model can fit for two or three months, therefore have the similar slope and intercept. The ANOVA would only do one part of this

Re: [R] Help needed for efficient way to loop through rows and columns

2012-05-16 Thread David L Carlson
Can you show us what you want the final data.frame to look like? You've created five variables stored as factors and you seem to be trying to change those to numeric values? Is that correct? Since AB and BA are always set to 1, you could just replace those values globally rather than mess with

Re: [R] correlation among variables in the same subset

2012-05-16 Thread R. Michael Weylandt
? cor e.g., x - data.frame(rnorm(5), rnorm(5), rnorm(5), rnorm(5), rnorm(5)) cor(x) Best, Michael On Wed, May 16, 2012 at 6:52 AM, Andrea Sica aerdna.s...@gmail.com wrote: Dear all, I have created a subset from my dataset, which contains 6 variables. I need to make the correlation among

Re: [R] tm package: problem of TermDocumentMatrix and minWordLength

2012-05-16 Thread Baoqiang Cao
try this: dtm - DocumentTermMatrix(examplecorpus, control = list(wordLengths=c(1,100))) On Wed, May 16, 2012 at 6:22 AM, C.H. chainsawti...@gmail.com wrote: Dear All, The following code illustrate the problem. [R code] require(tm) exampledoc - c(R is good, R is really good)

Re: [R] How to sum and group data by DATE in data frame

2012-05-16 Thread R. Michael Weylandt
Fascinating... dput() has never given me anything that looks like that I would have expected something much more like z - structure(c(123.53, 123.78, 124.24, 124.2, 124.07, 123.91, 123.44, 123.0616, 123.06, 123.13, 123.745, 123.96, 123.99, 123.99, 124.3, 124.38, 124.67, 125.19, 124.9, 125.27,

Re: [R] Reading Excel Formulas as values

2012-05-16 Thread David L Carlson
I can't replicate your problem. I created a spreadsheet in Excel 2007 consisting of three columns. Numbers from 1 - 15, rand(), and the sum of the first two columns. Using all the defaults with read.xlsx() (package: xlsx), I get the values of each column and using keepFormulas=TRUE, I get the

Re: [R] confidence intervals for nls or nls2 model

2012-05-16 Thread Francisco Mora Ardila
Thanks! Now it is clear. Francisco On Wed, 16 May 2012 07:32:56 -0400, Gabor Grothendieck wrote On Tue, May 15, 2012 at 11:20 PM, Gabor Grothendieck ggrothendi...@gmail.com wrote: On Tue, May 15, 2012 at 8:08 PM, Francisco Mora Ardila fm...@oikos.unam.mx wrote: Hi all I have fitted a

Re: [R] Error on easy way for JoSAE Package

2012-05-16 Thread David Winsemius
On May 16, 2012, at 1:33 AM, ana24maria wrote: Thank you very much. After using dput and the easy way ( result - eblup.mse.f.wrap(domain.data = amigo, lme.obj = fit.lme)), i have got the following error: Error in `[.data.frame`(sample.data, , variabs) : undefined columns selected What

Re: [R] finding mean and SD for a log-normal distribution

2012-05-16 Thread Uwe Ligges
On 16.05.2012 12:37, Andras Farkas wrote: Dear R Expert allow me to ask a quick qestion: I have a mean value of 6 and a SD of 3 describing my distribution. I would like to convert this distribution into a log normal distribution that would best describe it when resimulated using log normal

Re: [R] code to iterate function apply to matrix

2012-05-16 Thread Uwe Ligges
On 16.05.2012 08:11, umai88 wrote: I got this code below and i want to repeat the loop for 100 times.. And what is the problem? What are you aiming at? Uwe Ligges x-rnorm(60) mat1-matrix(x,nrow=15,ncol=4) trim-numeric(ncol(mat1)) win-numeric(ncol(mat1)) ssd-numeric(ncol(mat1)) for(j

Re: [R] How to use the value of rect to determine the location of legend

2012-05-16 Thread Uwe Ligges
On 16.05.2012 02:13, Gundala Viswanath wrote: Given the attached plot, Nothing came through. how can I locate the center text with Mean and SD so that it can be placed exactly under ---emp.? The current code I have is this: L = list(bquote(Em.Mean ==.(new_avg)),

Re: [R] caret: Error when using rpart and CV != LOOCV

2012-05-16 Thread Max Kuhn
More information is needed to be sure, but it is most likely that some of the resampled rpart models produce the same prediction for the hold-out samples (likely the result of no viable split being found). Almost every incarnation of R^2 requires the variance of the prediction. This particular

Re: [R] Need your help setting $R_check_force_suggests = FALSE on Windows system

2012-05-16 Thread Uwe Ligges
On 15.05.2012 19:23, Zhiqiu Hu wrote: r-help@r-project.org Dear friends, I want to make the following change of R setting on a windows 7 desktop. $R_check_force_suggests = FALSE You can change it globally in the operating systems defaults for environment variable, or for the current

[R] kolmogorov-Smirnov critical values

2012-05-16 Thread aramos
Hi! Any one knows how to obtain critical values for the k-s statistic, using R? Thanks, Alex -- View this message in context: http://r.789695.n4.nabble.com/kolmogorov-Smirnov-critical-values-tp4630245.html Sent from the R help mailing list archive at Nabble.com.

[R] Merging multiple data sets

2012-05-16 Thread Bharat Warule
Hello R user, I have four data sets in dir D:/Bharat Warule/Rdata_file which are output_data_prod_1.rda, output_data_prod_2.rda, output_data_prod_3.rda, output_data_prod_4.rda. Each data set is huge size like number of rows 343297 and columns are near to 50. For example: x1 -

[R] Hmisc improveProb() and PredictABEL reclassification () function and continuous NRI

2012-05-16 Thread Svingen, Gard Frodahl
Dear Sirs. I am working with the R packages Hmisc and PredictABEL to make NRI estimates from my Cox models with and without a specific biomarker. According to Pencina et al (Statistics in Medicine 2010, DOI: 0.1002/sim.4085 ), a continuous/non-categorical NRI (NRI0) is to be used when there

Re: [R] vector w/o arithmetic addition for boxplot

2012-05-16 Thread Uwe Ligges
On 15.05.2012 23:47, rl269 wrote: Hello, I am having trouble asking R to read individual numeric vectors for a box plot of the residuals of a linear regression. It is performing arithmetic addition on the 16 individual variables that I want individual box plots for. I have 16

[R] clusters in zero-inflated negative binomial models

2012-05-16 Thread Lies Durnez
Dear all, I want to build a model in R based on animal collection data, that look like the following Nr Village DistrictSiteSurvey Species Count 1 AX A F Dry B 0 2 AY A V Wet A 5 3 BX B F

Re: [R] Help needed for efficient way to loop through rows and columns

2012-05-16 Thread Rui Barradas
Hello, Your data.frame is composed exclusively of factors, but try this (I've changed the name to 'sampl', because 'sample' is an R function.) # logical index vectors iA - sampl$AorB == A iB - sampl$AorB == B new.sampl - data.frame( apply(sampl, 2, function(x){ iAA - x

Re: [R] kolmogorov-Smirnov critical values

2012-05-16 Thread R. Michael Weylandt
On Wed, May 16, 2012 at 9:52 AM, aramos ara...@fep.up.pt wrote: Hi! Any one knows how to obtain critical values for the k-s statistic, using R? Take a look at ?ks.test and the code of ks.test to see how R does it. OSS is super helpful for these sorts of things. Michael Thanks, Alex --

[R] install ggplot2 package

2012-05-16 Thread Yang, Ming
Has one try to install the ggplot2 package recently? I tried to install it on my new system and had trouble: install.packages(ggplot2) Installing package(s) into 'C:/Program Files/R/R-2.14.2/library' (as 'lib' is unspecified) also installing the dependency 'scales' trying URL

Re: [R] double buffering in windows() not working

2012-05-16 Thread Uwe Ligges
Fine for me, and I cannot investigate anything since there is not even a single piece of reproducible code given. Uwe Ligges On 15.05.2012 23:20, Daniel Carr wrote: I have doubled buffered animations that I show in class. They used to work but now flash. The default windows() option is

Re: [R] rpart - predict terminal nodes for new observations

2012-05-16 Thread Uwe Ligges
On 15.05.2012 16:30, tudor wrote: Dear useRs: Is there a way I could predict the terminal node associated with a new data entry in an rpart environment? In the example below, if I had a new data entry with an AM of 5, I would like to link it to the terminal node 2. My searches led to

Re: [R] Merging multiple data sets

2012-05-16 Thread Uwe Ligges
On 16.05.2012 15:51, Bharat Warule wrote: Hello R user, I have four data sets in dir D:/Bharat Warule/Rdata_file which are output_data_prod_1.rda, output_data_prod_2.rda, output_data_prod_3.rda, output_data_prod_4.rda. Each data set is huge size like number of rows 343297 and columns are near

Re: [R] kolmogorov-Smirnov critical values

2012-05-16 Thread Uwe Ligges
On 16.05.2012 15:52, aramos wrote: Hi! Any one knows how to obtain critical values for the k-s statistic, using R? ks.test(.)$statistic Uwe ligges Thanks, Alex -- View this message in context: http://r.789695.n4.nabble.com/kolmogorov-Smirnov-critical-values-tp4630245.html Sent from

Re: [R] install ggplot2 package

2012-05-16 Thread R. Michael Weylandt
It looks like there might be a mirror problem -- use chooseCRANmirror() to select a different mirror. Best, Michael On Wed, May 16, 2012 at 10:21 AM, Yang, Ming ming.y...@xerox.com wrote: Has one try to install the ggplot2 package recently? I tried to install it on my new system and had

Re: [R] install ggplot2 package

2012-05-16 Thread Uwe Ligges
Looks like your mirror was in an inconstant state. Seems to be fixed by a finished rysnc in the meantime ... Uwe ligges On 16.05.2012 16:21, Yang, Ming wrote: Has one try to install the ggplot2 package recently? I tried to install it on my new system and had trouble:

Re: [R] install ggplot2 package

2012-05-16 Thread Ista Zahn
Hi Yang, Did you try a different CRAN mirror? Best, Ista On Wed, May 16, 2012 at 10:21 AM, Yang, Ming ming.y...@xerox.com wrote: Has one try to install the ggplot2 package recently? I tried to install it on my new system and had trouble: install.packages(ggplot2) Installing package(s)

[R] simple data.frame question

2012-05-16 Thread Troels Ring
Dear friends - I hope you will forgive me another simple question, illustrated by ID - c(1,1,1,2,2,3,3,3) PERIOD - c(1,2,3,2,3,1,2,3) X - runif(8,0,10)) FF - data.frame(ID=ID,PERIOD=PERIOD,X=X) I need to the fourth value of X as NA, and ID and PERIOD is updated to 1,1,1,2,2,2,3,3,3 and

Re: [R] finding mean and SD for a log-normal distribution

2012-05-16 Thread David Winsemius
On May 16, 2012, at 6:37 AM, Andras Farkas wrote: Dear R Expert allow me to ask a quick qestion: I have a mean value of 6 and a SD of 3 describing my distribution. I would like to convert this distribution into a log normal distribution that would best describe it when resimulated using

[R] replacing with NA

2012-05-16 Thread Mintewab Bezabih
Dear R users, I was wondering how I can replace the values of a vector with the values from in another vector in the same row For example, how can I replace the value of x below with NA when the value of Z in the same row is NA? x -1:20 z- c(11, 15, 17, 2, 18, 6, 7, NA, 12, 10,21, 25, 27,

[R] replacing with NA

2012-05-16 Thread Mintewab Bezabih
Dear R users, I was wondering how I can replace the values of a vector with the values from in another vector in the same row For example, how can I replace the value of x below with NA when the value of Z in the same row is NA? x -1:20 z- c(11, 15, 17, 2, 18, 6, 7, NA, 12, 10,21, 25, 27,

Re: [R] replacing with NA

2012-05-16 Thread R. Michael Weylandt
x[is.na(z)] - NA This might send you a nasty bug if x and z are different lengths though -- just a head's up. Michael On Wed, May 16, 2012 at 12:55 PM, Mintewab Bezabih mintewab.beza...@economics.gu.se wrote: Dear R users, I was wondering  how I can replace the values of a vector with the

Re: [R] confidence intervals for nls or nls2 model

2012-05-16 Thread Walmes Zeviani
If you want a confidence based in new x values you can do. I have this post with steps to do this. It's written in Portuguese but the R code is useful. http://ridiculas.wordpress.com/2011/05/19/bandas-de-confianca-para-modelo-de-regressao-nao-linear/ Bests. Walmes.

[R] how disable the Error massage in read.table() no lines available in input

2012-05-16 Thread gianni lavaredo
Dear Researchers, I am looking a way to disable the Error massage in read.table() as warn = TRUE in readLines(), when the lines are empty Error in read.table(con, header = F, sep = , nrow = n) : no lines available in input thanks for all suggestions Gianni [[alternative HTML version

Re: [R] simple data.frame question

2012-05-16 Thread David Winsemius
On May 16, 2012, at 11:56 AM, Troels Ring wrote: Dear friends - I hope you will forgive me another simple question, illustrated by ID - c(1,1,1,2,2,3,3,3) PERIOD - c(1,2,3,2,3,1,2,3) X - runif(8,0,10)) Extraneous paren removed: FF - data.frame(ID=ID,PERIOD=PERIOD,X=X) I need to the

Re: [R] simple data.frame question

2012-05-16 Thread Troels Ring
Thanks a lot - beautiful Troels Den 16-05-2012 19:29, David Winsemius skrev: On May 16, 2012, at 11:56 AM, Troels Ring wrote: Dear friends - I hope you will forgive me another simple question, illustrated by ID - c(1,1,1,2,2,3,3,3) PERIOD - c(1,2,3,2,3,1,2,3) X - runif(8,0,10))

[R] Finding words that are within +/- X words of KRAS using tm package or other means

2012-05-16 Thread Paul Miller
Hello All, This will probably be easy for some but isn't for me. Currently am working on a text mining exercise. Want to be able to predict whether cancer patients got KRAS testing, and, if so, whether the test yielded a result of wild type/negative or mutant/positive. I've begun with a

[R] transfer R objects back to console/command line

2012-05-16 Thread Jannis
Dear R community, is there any way to invoke R in batch mode, do some calculations and get the values of some R variables back into the (bash)shell ? I only managed to get some output saved into a text file with: R --slave --args 2 2 test.Rtest2.R test.R contains: a -

Re: [R] transfer R objects back to console/command line

2012-05-16 Thread R. Michael Weylandt
Take a look at this SO question: http://stackoverflow.com/questions/10575005/output-a-boolean-from-an-rscript-into-a-bash-variable None of the solutions are Boolean specific so you should be good with them (the key is printing and capturing) Michael On Wed, May 16, 2012 at 2:36 PM, Jannis

Re: [R] kolmogorov-Smirnov critical values

2012-05-16 Thread Petr Savicky
On Wed, May 16, 2012 at 06:52:48AM -0700, aramos wrote: Hi! Any one knows how to obtain critical values for the k-s statistic, using R? Hi. I do not know, whether there is a function for this. However, the following randomized approach allows to extract a table of statistic/p.value pairs

Re: [R] Scraping a web page.

2012-05-16 Thread Keith Weintraub
Thanks Gabor, Nifty regexp. I never used strapplyc before and I am sure this will become a nice addition to my toolkit. KW Message: 5 Date: Tue, 15 May 2012 07:55:33 -0400 From: Gabor Grothendieck ggrothendi...@gmail.com To: Keith Weintraub kw1...@gmail.com Cc: r-help@r-project.org Subject:

[R] Optimization problem

2012-05-16 Thread Pacin Al
Hi, I'm dealing with an optimization problem. I'm using 'optim' to maximize the output of a function, given some restrictions on the input. I would like to know if there is a way to impose some restrictions on 'intermediate variables' of the function. An example.. fx = function (x) { s - 0 for

Re: [R] caret: Error when using rpart and CV != LOOCV

2012-05-16 Thread Dominik Bruhn
Thanks Max for your answer. First, I do not understand your post. Why is it a problem if two of predictions match? From the formula for calculating R^2 I can see that there will be a DivByZero iff the total sum of squares is 0. This is only true if the predictions of all the predicted points from

Re: [R] caret: Error when using rpart and CV != LOOCV

2012-05-16 Thread Dominik Bruhn
Sorry for the follow-up, but I dig deeper into the problem. My text on the R^2 was wrong: In my opinion, and at least to Wikipedia, R^2 yields a division by zero iff SStot (the total sum of squares) is zero. SStot is the sum of the sum of the difference between the observed (not the predicted)

[R] Job posting - Statistical Consultant - Univ. of Texas at Austin

2012-05-16 Thread Mahometa, Michael J
All, Just to get the word out: We are looking for a new Statistical Consultant at the Division of Statistics and Scientific Computation here at the University of Texas at Austin. Please pass along to any colleagues who might be interested... http://ssc.utexas.edu/people/employment Thanks,

Re: [R] kolmogorov-Smirnov critical values

2012-05-16 Thread aramos
I think that command will give me the statistics observed value!! Not quantiles from the k-s distribution! -- View this message in context: http://r.789695.n4.nabble.com/kolmogorov-Smirnov-critical-values-tp4630245p4630275.html Sent from the R help mailing list archive at Nabble.com.

[R] fitting t copula with fixed dof

2012-05-16 Thread ergen
I need to fit a t copula with fixed degree of freedom let's say 4. I do not want to estimate the dof together with correlation matrix optimally. Instead fix the dof to 4 and only estimate the correlation matrix in the optimization routine. Is anyone aware of such estimation method in R.

Re: [R] kolmogorov-Smirnov critical values

2012-05-16 Thread aramos
Thanks, I've already done that!! What is OSS? -- View this message in context: http://r.789695.n4.nabble.com/kolmogorov-Smirnov-critical-values-tp4630245p4630276.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org

Re: [R] Help needed for efficient way to loop through rows and columns

2012-05-16 Thread Priya Bhatt
Yes here it is. I actually convert them all as strings, initially using options(stringsAsFactors=F) at the top of my code. This what the initial dataframe looks like. Please note this is a toy dataset: namesXYZAorB S1BBBBBBA S2AABBBBA S3AB

Re: [R] kolmogorov-Smirnov critical values

2012-05-16 Thread R. Michael Weylandt
Open source software (what you're driving) Michael On Wed, May 16, 2012 at 12:27 PM, aramos ara...@fep.up.pt wrote: Thanks, I've already done that!! What is OSS? -- View this message in context: http://r.789695.n4.nabble.com/kolmogorov-Smirnov-critical-values-tp4630245p4630276.html Sent

Re: [R] simple data.frame question

2012-05-16 Thread arun
Hi Troels, Not sure this is what you want. X-runif(9,0,10) FF1-data.frame(ID=c(1,2,3)[rep(c(1,1,1,2,2,2,3,3,3))], PERIOD=c(1,2,3)[rep(c(1,2,3),times=3)],X=X) FF1$X[4]-NA FF1   ID PERIOD  X 1  1  1 8.27119347 2  1  2 9.64698097 3  1  3 2.74132386 4  2  1 NA 5 

[R] TukeyHSD plot error

2012-05-16 Thread Bret Jagger
Hi, I am seeking help with an error when running the example from R Documentation for TukeyHSD. The error occurs with any example I run, from any text book or website. thank you... plot(TukeyHSD(fm1, tension)). Error in plot(confint(as.glht(x)), ylim = c(0.5, n.contrasts + 0.5), ...) : error

[R] error code trying to extract second column from coeftest output

2012-05-16 Thread rl269
I want to use the standard error values in the summary that is produced using coeftest, but I am getting an error code- any ideas? library(lmtest) coeftest(lmodT_WBHO) t test of coefficients: Estimate Std. Error t value Pr(|t|) t1W 5.948190.17072 34.8410 2.2e-16 *** t2W

[R] Getting reliable financial ratios

2012-05-16 Thread Keith Weintraub
Check out this site: http://www.gummy-stuff.org/Yahoo-data.htm It shows how to download a .csv file with the data you might want. Here is an example URL: http://finance.yahoo.com/d/quotes.csv?s=XOM+BBDb.TO+JNJ+MSFTf=snd1l1yrr2 The r2 in the above URL means P/E ratio. You should be able to

Re: [R] kolmogorov-Smirnov critical values

2012-05-16 Thread David Winsemius
On May 16, 2012, at 12:27 PM, aramos wrote: Thanks, I've already done that!! But the illustration for how you get the statistics is in the code. Describe what you want: number of samples, two versus single sided, two sample versus comparing to theory, which table columns should be used.

[R] Scraping a web page.

2012-05-16 Thread Keith Weintraub
Duncan, Thanks for the advice. It turns out that the web pages are pretty well behaved. I ended up using readHTMLTable str_select grep gsub readLines When I have time I am going to convert my code to use the html parser and the more robust getNodeSet method that you mention below. Thanks

Re: [R] finding mean and SD for a log-normal distribution

2012-05-16 Thread peter dalgaard
On May 16, 2012, at 12:37 , Andras Farkas wrote: Dear R Expert allow me to ask a quick qestion: I have a mean value of 6 and a SD of 3 describing my distribution. I would like to convert this distribution into a log normal distribution that would best describe it when resimulated using

[R] trouble with ifelse statement

2012-05-16 Thread Melissa Rosenkranz
Hello, I apologize in advance for not providing sample data, I'm a very new to R and can't easily generate appropriate sample data quickly. I'm hoping someone can offer advice without it. This code below works and does what I want it to do, which is for a given row in my dataframe, where the

[R] survival survfit with newdata

2012-05-16 Thread Damjan Krstajic
Dear all, I am confused with the behaviour of survfit with newdata option. I am using the latest version R-2-15-0. In the simple example below I am building a coxph model on 90 patients and trying to predict 10 patients. Unfortunately the survival curve at the end is for 90 patients. Could

Re: [R] clusters in zero-inflated negative binomial models

2012-05-16 Thread Ben Bolker
Lies Durnez ldurnez at itg.be writes: I want to build a model in R based on animal collection data, that look like the following NrVillage DistrictSiteSurvey Species Count 1 AX A F Dry B 0 2 AY A V Wet A 5 3

Re: [R] Optimization problem

2012-05-16 Thread Greg Snow
There are a couple of options. First if you want the mean to equal 7, then that means the sum must equal 21 and therefore you can let optim only play with 2 of the variables, then set the 3rd to be 21-s1-s2. If you want the mean to be greater than 7 then just put in a test, if the mean is less

[R] variable spatial correlation

2012-05-16 Thread m p
Hello, I used correlogram from spatial package to determine correlation scale for my data but just looking with bare eye it seems that the correlation scale varies over the domain. Can someone suggest what would the best way to handle that problem? Thanks, Mark [[alternative HTML version

Re: [R] trouble with ifelse statement

2012-05-16 Thread R. Michael Weylandt
It seems like your problem is that R can't find your variable sample and is instead finding its own sample() function which can't be compared to an integer and is giving your problem. It seems likely that sample is part of raw.saliva.data? If that's the case, change sample --

Re: [R] error code trying to extract second column from coeftest output

2012-05-16 Thread Jeff Newmiller
I recommend that you troubleshoot your own problem using the str function... for example, str( coeftest(lmodT_WBHO)). The error message is not a code... it is perfectly readable English, and it is telling you that the result of calling coeftest is not a list with parts that can be pulled out

Re: [R] TukeyHSD plot error

2012-05-16 Thread R. Michael Weylandt
Hmmm, I can't reproduce, but I'm not really sure why that would happen... is there any way you can test this in a --vanilla R session? (That's the UNIX-y way to start a totally clean session; not sure exactly how to achieve that on Windows) Does this happen if you just run example(TukeHSD)

[R] Unable to install package

2012-05-16 Thread Rismyname
Hi, I get the following error while installing a package. Can someone please help? install.packages(memisc) Warning in install.packages : argument 'lib' is missing: using 'C:/Users/ravi/Documents/R/R-2.15.0' Warning in install.packages : downloaded length 8255 != reported length 200 Error in

[R] triangular matrices input/output

2012-05-16 Thread casperyc
Hi, Is there any package that deals with triangular matrices? Say ways of inputting an upper (lower) triangular matrix? Or convert a vector of length 6 to an upper (lower) triangular matrix (by row/column)? Thanks! - ## PhD candidate in Statistics Big R Fan Big LEGO

Re: [R] trouble with ifelse statement

2012-05-16 Thread Rui Barradas
Hello, 'sample' is a really bad name for a variable, it's already taken, it's an R function. sample1 sample5 # '' is not vectorized, it's '' you want. # Without 'ifelse' raw.saliva.data$max.cort[index] - raw.saliva.data$cortisol[index sample 1 sample 5] Negate this last conjunction if

[R] Updating Neural Networks

2012-05-16 Thread Josh Browning
Hi useR’s, I apologize if I’ve missed some documentation somewhere, but I can’t seem to find anything related to this question… For a ensemble/data-mining problem, I’m trying to train a neural network on my data set and have it output predictions (or coefficients) after varying numbers of

Re: [R] triangular matrices input/output

2012-05-16 Thread R. Michael Weylandt
The Matrix package provides good support for many special sorts of matrices, but here it looks like you probably don't need that additional machinery for such small case: makeUpper - function(vec, diag = FALSE){ n - (-1 + sqrt(1 + 8*length(vec)))/2 stopifnot(isTRUE(all.equal(n,

Re: [R] Lattice: Add abline to Single Value qqmath() Plot

2012-05-16 Thread Rich Shepard
On Tue, 15 May 2012, ilai wrote: Apologies in advance if I misinterpret R console insists that I retype ... but actually makes more sense (than sourcing a script) to use the group argument (see the last example in ?qqmath) as in 4 groups in each of 30 panels, or allow.multiple=T, outer=T if

Re: [R] triangular matrices input/output

2012-05-16 Thread R. Michael Weylandt michael.weyla...@gmail.com
Do leave the posts for anyone else who might google the same question. (I don't think you really could delete the post anyways, perhaps only on one mirror) You could probably use some combination or rev() and t() to fill by row, but I haven't thought through the geometry all the way yet.

[R] subreddit for R related stuff

2012-05-16 Thread Robert M. Flight
Thought there might be some Redditors lurking on these mailing lists. I created a sub-reddit for R (and by extension Bioconductor) discussions, links, etc. http://www.reddit.com/r/Rsoftware/ This will be the first and only shameless plug. -Robert Robert M. Flight, Ph.D. University of

[R] using XML package to read RSS

2012-05-16 Thread J Toll
Hi, I'm trying to use the XML package to read an RSS feed. To get started, I was trying to use this post as an example: http://www.r-bloggers.com/how-to-build-a-dataset-in-r-using-an-rss-feed-or-web-page/ I can replicate the beginning section of the post, but when I try to use another RSS feed

Re: [R] using XML package to read RSS

2012-05-16 Thread Duncan Temple Lang
Hi James. Yes, you need to identify the namespace in the query, e.g. getNodeSet(doc, //x:entry, c(x = http://www.w3.org/2005/Atom;)) This yeilds 40 matching nodes. (getNodeSet() is more convenient to use when you don't specify a function to apply to the nodes. Also, you don't need

Re: [R] caret: Error when using rpart and CV != LOOCV

2012-05-16 Thread Max Kuhn
Dominik, See this line:   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.  30.37   30.37   30.37   30.37   30.37   30.37 The variance of the predictions is zero. caret uses the formula for R^2 by calculating the correlation between the observed data and the predictions which uses sd(pred) which

Re: [R] using XML package to read RSS

2012-05-16 Thread J Toll
On Wed, May 16, 2012 at 9:02 PM, Duncan Temple Lang dun...@wald.ucdavis.edu wrote: Hi James.  Yes, you need to identify the namespace in the query, e.g.  getNodeSet(doc, //x:entry, c(x = http://www.w3.org/2005/Atom;)) This yeilds 40 matching nodes. (getNodeSet() is more convenient to use

  1   2   >