Re: [R] R 2.11 on Mac OS X

2013-06-24 Thread David Winsemius
On Jun 23, 2013, at 7:24 PM, Norman Jessup wrote: David, Thank you. You are correct - I was inadvertently accessing an old version. Deleting the old and re-installing means I can fire up R V3.0.1 which runs fine. However, I still can't get R Studio to start up, receivng the

Re: [R] Wilcox paired test error message

2013-06-24 Thread peter dalgaard
On Jun 23, 2013, at 22:30 , Sarah Goslee wrote: Hi, If you're doing exactly as described below, then you need to add the data argument to wilcox.test so R knows where to find beforesmall and aftersmall. But if so, that's a rather uninformative error message. Saraj Not really, if you

Re: [R] R 2.11 on Mac OS X

2013-06-24 Thread Jeff Newmiller
RStudio questions belong on the RStudio support website. It is fine software, but it is off-topic here. --- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.us

[R] Looping in Matrix

2013-06-24 Thread Fazli Raziq
Hello all, I want to construct Two way Matrix. The Algorithm is like: 1)  Data of time with censoring or events 2)  Predictor variables (genes) 3)  Resample original data in step 1 and 2 by WR 4)  Apply Coxph Model to resample data. (Apply Surv function to each Predictor variable, individually)

[R] Avoiding loops using 'for' and pairwise comparison of columns

2013-06-24 Thread Kulupp
Dear R-experts, I'd like to avoid the use of very slow 'for'-loops but I don't know how. My data look as follows (the original data has 1600 rows and 30 columns): # data example c1 - c(1,1,1,0.25,0,1,1,1,0,1) c2 - c(0,0,1,1,0,1,0,1,0.5,1) c3 - c(0,1,1,1,0,0.75,1,1,0.5,0) x -

Re: [R] Avoiding loops using 'for' and pairwise comparison of columns

2013-06-24 Thread Blaser Nello
Here's a possible solution to avoid the loop k - as.matrix(expand.grid(1:ncol(x),1:ncol(x))) a1 - as.data.frame(matrix(sapply(1:nrow(k), function(n) agree(x[,k[n,]])$value), nrow=ncol(x))) colnames(a1) - colnames(x) rownames(a1) - colnames(x) identical(a, a1) [1] TRUE Or if you want to avoid

Re: [R] R: Apply a Seasonal ARMA process

2013-06-24 Thread Rui Barradas
Hello, You have three parameters, two sar and one intercept. arima(x, order=c(0,0,0), seasonal=list(order=c(2,0,0), period=4), transform.pars = FALSE, fixed = c(0.54, 0.5, rep(NA, 1))) I also believe that the answer you got from Rolf is more to the point. Try something along the lines

[R] help needed with printing multiple arguments as vectors, not matrices

2013-06-24 Thread Angel Russo
** I am using the following way to get p-values from fiser exact test. However, I do need to print for each pair the values n00, n01, n10, n11. How can I print that as a table and not a matrix as below along with the p-value? Any help will be greatly appreciated fish - function(y, x) {n00 =

[R] Error with metaMDS

2013-06-24 Thread Suparna Mitra
H ello R-experts, I want to do ordination plots using vegan metaMDS. I have a where many cells have zero values. Data structure: X[1:10,1:14] Height.1 Height.2 Height.3 Height.4 Height.5 Height.6 Height.7 Height.8 Height.9 Height.10 Height.11 Height.12 Height.13 D30I1A 460

Re: [R] Wilcox paired test error message

2013-06-24 Thread Sarah Goslee
G'morning. On Mon, Jun 24, 2013 at 2:22 AM, peter dalgaard pda...@gmail.com wrote: On Jun 23, 2013, at 22:30 , Sarah Goslee wrote: Hi, If you're doing exactly as described below, then you need to add the data argument to wilcox.test so R knows where to find beforesmall and aftersmall. But

Re: [R] Error with metaMDS

2013-06-24 Thread Sarah Goslee
Hi, What do you expect the dissimilarity between a site with no species and a site with some species to be? If you want to use Bray-Curtis dissimilarity, you need to drop the sites with no species, as the error message suggests. But if you can answer my first question, you may be able to select

[R] K-means results understanding!!!

2013-06-24 Thread Dzu
Dear members. I am having problems to understand the kmeans- results in R. I am applying kmeans-algorithms to my big data file, and it is producing the results of the clusters. Q1) Does anybody knows how to find out in which cluster (I have fixed numberofclusters = 5 ) which data have been

[R] Tolearance Interval calculation for each point in a data set?

2013-06-24 Thread Johannes Graumann
Hello, I am looking for tolerance interval related methodologies and found the package tolerance which will e.g. nicely calculate the 95%/95% tolerance limits of a given regression. What I am looking for, however is not only the the tolerance limits this calculation defines, but I would like

Re: [R] Calculating an index of colocation for a large dataset

2013-06-24 Thread Adams, Jean
Are you saying that the dive data for a single whale with 8 dives is stored in 8 separate files? How are you reading these files into R? read.table()? Could you post an example of the line of code that reads in the data? Something like this might work for you. # vector of file names file.names

Re: [R] (no subject)

2013-06-24 Thread Adams, Jean
What was the line of code you submitted right before the error? Jean On Sat, Jun 22, 2013 at 12:36 AM, lay khoon lovelybear...@gmail.com wrote: Hi, I had been using a script that works fine for several days and then I stopped using it for a month without having doubt that it would

Re: [R] K-means results understanding!!!

2013-06-24 Thread David Carlson
You should read the help page ?kmeans Especially the section labeled Value which tells you what kmeans returns. You will see that the cluster membership is returned as a vector of integers called cluster. If you don't know how to access that from kmeans.results, you haven't read any of the basic

Re: [R] help needed with printing multiple arguments as vectors, not matrices

2013-06-24 Thread Adams, Jean
Could you provide an example of mat1 and mat2 as well as an example of the output you would like from them. Your code is very difficult to follow as written. It will be easier for readers of the list to interpret if you use carriage returns rather than semi colons, for example ... fish -

Re: [R] K-means results understanding!!!

2013-06-24 Thread Dzu
Hi, Thanks for reply but I already read the help page I am new in R and did not understand the output description of kmeans -function. That is why I wanted to ask some experts in the group. My point is that I do not understand which data are combined in the specific cluster? I tried the

Re: [R] Wilcox paired test error message

2013-06-24 Thread peter dalgaard
On Jun 24, 2013, at 15:21 , Sarah Goslee wrote: G'morning. On Mon, Jun 24, 2013 at 2:22 AM, peter dalgaard pda...@gmail.com wrote: On Jun 23, 2013, at 22:30 , Sarah Goslee wrote: Hi, If you're doing exactly as described below, then you need to add the data argument to wilcox.test

Re: [R] help needed with printing multiple arguments as vectors, not matrices

2013-06-24 Thread Angel Russo
Sample data is as follows (for simplicity assume mat1 and mat2 are the same matrices). Also attached as an excel file. I want to get the pairwise interaction fischer test results. Not just the pvalues but also want to wrote the n00, n01, n10 and n11 in the file as: ADCK2_mat1 ADCK3_mat2 n00 n01

[R] extracting submatrix from a bigger one

2013-06-24 Thread matteo
Hi guys, I'm a newby, so sorry for the easy question. I have a matrix (459x28) in which a large number of observations are repeated (same placed sampled in different times). One of the columns is refers to the ID of the place of sampling. What I would like is to extract subset matrix for every

Re: [R] Looping in Matrix

2013-06-24 Thread David Winsemius
On Jun 24, 2013, at 12:13 AM, Fazli Raziq wrote: Hello all, I want to construct Two way Matrix. The Algorithm is like: 1) Data of time with censoring or events 2) Predictor variables (genes) 3) Resample original data in step 1 and 2 by WR 4) Apply Coxph Model to resample data.

Re: [R] Error with metaMDS

2013-06-24 Thread Suparna Mitra
Dear Sarah, Thanks for your reply. But I don't have any site where all the species are 0. Is there anyway to calculate the dissimilarity between sites where it computes only the non-zero species values. Excluding all the zero event will result a big loss in species data. I don't want to delete

[R] renaming of miktex package broke R package building

2013-06-24 Thread Sancar Adali
the inconsolata miktex package (inconsolata-zi4 in CTAN) which contains the font of the same name was recently updated. It now contains the file zi4.sty instead of inconsolata.sty. When I was building an R package, the help(or vignette) file pdf couldn't built , because R couldn't find

Re: [R] extracting submatrix from a bigger one

2013-06-24 Thread Rui Barradas
Hello, Try the following. result - lapply(unique(dataset$ID), function(uid) dataset[dataset$ID == uid, ]) names(result) - unique(dataset$ID) Hope this helps, Rui Barradas Em 24-06-2013 15:36, matteo escreveu: Hi guys, I'm a newby, so sorry for the easy question. I have a matrix

[R] Conference on Statistical Practice

2013-06-24 Thread Adams, Jean
R users, The deadline for submission of abstracts is *** TOMORROW *** (Tuesday, June 25). Abstracts are now being accepted for the 2014 ASA Conference on Statistical Practice, February 20-24, Tampa, Florida, USA. Each presentation will have a 45-minute time slot. Based on a survey of the 2013

Re: [R] renaming of miktex package broke R package building

2013-06-24 Thread Berend Hasselman
On 24-06-2013, at 18:21, Sancar Adali sad...@gmail.com wrote: the inconsolata miktex package (inconsolata-zi4 in CTAN) which contains the font of the same name was recently updated. It now contains the file zi4.sty instead of inconsolata.sty. When I was building an R package, the help(or

Re: [R] extracting submatrix from a bigger one

2013-06-24 Thread matteo
Hi, result - lapply(unique(dataset$ID), function(uid) dataset[dataset$ID == uid, ]) Ok, I have the element result as a list names(result) - unique(dataset$ID) Nothing happens. I don't have any submatrix... Matteo __ R-help@r-project.org mailing

Re: [R] extracting submatrix from a bigger one

2013-06-24 Thread Bert Gunter
First of all, is your data structure a matrix or a data frame? They are different! Assuming the latter, a shorter version of Rui's answer that avoids unique() and automatically takes care of names is: result - by(dataset, dataset$ID,I) See ?by, ?tapply, and ?split -- Bert On Mon, Jun 24, 2013

Re: [R] extracting submatrix from a bigger one

2013-06-24 Thread Rui Barradas
Hello, You don't have a sub-data.frame, what you have is a list, with each element of that list a df. Try to see, for instance, result[[1]]. This should be a data.frame corresponding to the first ID. Rui Barradas Em 24-06-2013 18:03, matteo escreveu: Hi, result -

Re: [R] extracting submatrix from a bigger one

2013-06-24 Thread David Winsemius
Sorry for the blank message. The default behavior of the Mac Mail.app spell checker has me confused. On Jun 24, 2013, at 10:03 AM, matteo wrote: Hi, result - lapply(unique(dataset$ID), function(uid) dataset[dataset$ID == uid, ]) Ok, I have the element result as a list names(result) -

Re: [R] extracting submatrix from a bigger one

2013-06-24 Thread Rui Barradas
Hello, I had forgotten the much simpler solutions. The following should do it. split(dataset, dataset$ID) Rui Barradas Em 24-06-2013 18:13, Bert Gunter escreveu: First of all, is your data structure a matrix or a data frame? They are different! Assuming the latter, a shorter version of

Re: [R] extracting submatrix from a bigger one

2013-06-24 Thread David Winsemius
On Jun 24, 2013, at 10:03 AM, matteo wrote: Hi, result - lapply(unique(dataset$ID), function(uid) dataset[dataset$ID == uid, ]) Ok, I have the element result as a list names(result) - unique(dataset$ID) Nothing happens. I don't have any submatrix... Matteo

Re: [R] extracting submatrix from a bigger one

2013-06-24 Thread Bert Gunter
Oh yes, that's even better! -- Bert On Mon, Jun 24, 2013 at 10:33 AM, Rui Barradas ruipbarra...@sapo.pt wrote: Hello, I had forgotten the much simpler solutions. The following should do it. split(dataset, dataset$ID) Rui Barradas Em 24-06-2013 18:13, Bert Gunter escreveu: First of

Re: [R] Apply acf to data frame containing 'NA'

2013-06-24 Thread arun
Hi, Try this: res1-do.call(cbind,t(sapply(res,c))[,1]) #get the acf values only.  Assuming that is what you wanted.  write.csv(res1,AMSacf.csv,row.names=FALSE) A.K. From: Zilefac Elvis zilefacel...@yahoo.com To: arun smartpink...@yahoo.com Sent: Monday,

Re: [R] extracting submatrix from a bigger one

2013-06-24 Thread Bert Gunter
Inline below... On Mon, Jun 24, 2013 at 11:31 AM, matteo matteo.ghe...@gmail.com wrote: First of all, thanks for all the replies!! What you have written helps, but is not entirely the answer to my problem. What I'd have is the creation of new data.frames each of one named with the ID of the

Re: [R] extracting submatrix from a bigger one

2013-06-24 Thread matteo
First of all, thanks for all the replies!! What you have written helps, but is not entirely the answer to my problem. What I'd have is the creation of new data.frames each of one named with the ID of the original dataframe and with all the columns. For example, in the original dataframe one

Re: [R] Error with metaMDS

2013-06-24 Thread Sarah Goslee
Hi, On Mon, Jun 24, 2013 at 12:04 PM, Suparna Mitra suparna.mitra...@gmail.com wrote: Dear Sarah, Thanks for your reply. But I don't have any site where all the species are 0. Well, that's what this says: 1: In distfun(comm, method = distance, ...) : you have empty rows: their

Re: [R] help needed with printing multiple arguments as vectors, not matrices

2013-06-24 Thread Adams, Jean
When sharing data, use dput() to output the data in a way that R-Help readers can easily use. Give this code a try and see if it helps. Jean # read in the example data mat1 - structure(list(GENE SYMBOL = c(ADCK2, ADCK3, ADCK4, ADCK5, ADRBK1, ADRBK2, AKT1, AKT2, AKT3, ALK), Sample.A1.A0SK.01

Re: [R] extracting submatrix from a bigger one

2013-06-24 Thread William Dunlap
First of all, thanks for all the replies!! What you have written helps, but is not entirely the answer to my problem. What I'd have is the creation of new data.frames each of one named with the ID of the original dataframe and with all the columns. What was suggested gave you a list of

[R] Nomogram (rms) for model with shrunk coefficients

2013-06-24 Thread Sander van Kuijk
Dear R-users, I have used the nomogram function from the rms package for a logistic regresison model made with lrm(). Everything works perfectly (r version 2.15.1 on a mac). My question is this: if my final model is not the one created by lrm, but I internally validated the model and 'shrunk' the

Re: [R] Scaling Statistical

2013-06-24 Thread Olga Musayev
Rui-- thanks so much for the help! I'm getting this error though, which is leaving me stumped: test-lapply(ids, function(i) { if(!any(is.na(df[df$ID==i,3]))) {adf.test(df[df$ID==i, 3])} else {NA} }) Error in if (interpol == min(tablep)) warning(p-value smaller than printed p-value)

Re: [R] Error with metaMDS

2013-06-24 Thread Gavin Simpson
On Mon, 2013-06-24 at 19:33 +0800, Suparna Mitra wrote: H ello R-experts, I want to do ordination plots using vegan metaMDS. I have a where many cells have zero values. snip / I am having two different kind of errors for these two data... Error 1 ord1 - metaMDS( X =bray) That is

Re: [R] help needed with printing multiple arguments as vectors, not matrices

2013-06-24 Thread Angel Russo
Awesome! Thanks so much for your help. I am able to get the format I was looking for. On Mon, Jun 24, 2013 at 2:50 PM, Adams, Jean jvad...@usgs.gov wrote: When sharing data, use dput() to output the data in a way that R-Help readers can easily use. Give this code a try and see if it helps.

Re: [R] Scaling Statistical

2013-06-24 Thread Rui Barradas
Hello, From the help page for ?adf.test: The p-values are interpolated from Table 4.2, p. 103 of Banerjee et al. (1993). I believe it's a problem with your data. Putting a print statement in the code for adf.test() gave me the following: Call: lm(formula = yt ~ xt1 + 1 + tt + yt1)

Re: [R] Scaling Statistical

2013-06-24 Thread Olga Musayev
That makes a lot of sense. Thank you, Rui! On Mon, Jun 24, 2013 at 3:41 PM, Rui Barradas ruipbarra...@sapo.pt wrote: Hello, From the help page for ?adf.test: The p-values are interpolated from Table 4.2, p. 103 of Banerjee et al. (1993). I believe it's a problem with your data. Putting a

[R] Lexical scoping is not what I expect

2013-06-24 Thread David Kulp
According to http://cran.r-project.org/doc/contrib/Fox-Companion/appendix-scope.pdf and other examples online, I am to believe that R resolves variables using lexical scoping by following the frames up the call stack. However, that's not working for me. For example, the following code, taken

Re: [R] Lexical scoping is not what I expect

2013-06-24 Thread Rui Barradas
Hello, The object 'a' exists if function f() not in the global environment where g() is defined. R is in fact going up, but to the global environment and not finding 'a'. Try, as an example, the following. f - function(x) { g - function(y) { y + a } a - 5 g(x) }

Re: [R] Lexical scoping is not what I expect

2013-06-24 Thread Gabor Grothendieck
On Mon, Jun 24, 2013 at 4:27 PM, David Kulp dk...@fiksu.com wrote: According to http://cran.r-project.org/doc/contrib/Fox-Companion/appendix-scope.pdf and other examples online, I am to believe that R resolves variables using lexical scoping by following the frames up the call stack.

Re: [R] Lexical scoping is not what I expect

2013-06-24 Thread arun
 f1- function(x){env- parent.frame();env$a-5; g(x)} f1(2) #[1] 7  f1(7) #[1] 12  f1(5) #[1] 10 A.K. From: David Kulp dk...@fiksu.com To: r-help@r-project.org r-help@r-project.org Sent: Monday, June 24, 2013 4:27 PM Subject: [R] Lexical scoping is not what I

Re: [R] Lexical scoping is not what I expect

2013-06-24 Thread Rolf Turner
I hope that Robert Gentleman is currently getting a thrill. :-) [See fortune(lexical scoping).] cheers, Rolf Turner __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] Lexical scoping is not what I expect

2013-06-24 Thread Marc Schwartz
On Jun 24, 2013, at 3:27 PM, David Kulp dk...@fiksu.com wrote: According to http://cran.r-project.org/doc/contrib/Fox-Companion/appendix-scope.pdf and other examples online, I am to believe that R resolves variables using lexical scoping by following the frames up the call stack.

Re: [R] Nomogram (rms) for model with shrunk coefficients

2013-06-24 Thread Frank Harrell
You are using an informal shrinkage method. It is much better to use penalized maximum likelihood estimation, built in to lrm. If you really want to go the informal route, compute the linear predictor from your final estimates and use ols( ) to predict that from the component variables

Re: [R] Nomogram (rms) for model with shrunk coefficients

2013-06-24 Thread David Winsemius
On Jun 24, 2013, at 12:00 PM, Sander van Kuijk wrote: Dear R-users, I have used the nomogram function from the rms package for a logistic regresison model made with lrm(). Everything works perfectly (r version 2.15.1 on a mac). My question is this: if my final model is not the one created

[R] Need help using Rcpp + Rmpi

2013-06-24 Thread Molly Davies
Hello, This might belong in the R-devel category, but I am not a C / C++ programmer, so I thought I'd start here. I have just written my first R extension using Rcpp, and it is SO much faster than my best R efforts, thank you for such a wonderful package! Instead of writing a separate text file, I

[R] packages for input messages

2013-06-24 Thread Francesco Miranda
Hello,I was trying to enter commands input messages or error within a routin.for example : msg (consistency error: at the time ( j : generic time ) the lower quantile is not less than the upper quantile) thanks in advanceFrancesco Miranda

[R] Running MCMC using R2WinBUGS

2013-06-24 Thread Anamika Chaudhuri
Hi All: Not sure why my previous question never got posted. Here I am seeking some help on my code. I am using the following code to run MCMC simulation on the following data using the model below: # Data matrix-NULL csvs-paste(MVN, 1:2,.csv,sep=) for (i in 1:length(csvs)){ + matrix[[i]]-

Re: [R] Need help using Rcpp + Rmpi

2013-06-24 Thread Dirk Eddelbuettel
Hi Mollyy, On 24 June 2013 at 14:53, Molly Davies wrote: | Hello, | This might belong in the R-devel category, but I am not a C / C++ | programmer, so I thought I'd start here. I have just written my first R The convention is that package-specific question go to the package specific forums. In

Re: [R] packages for input messages

2013-06-24 Thread Sarah Goslee
It sounds like ?stop is what you're looking for. Sarah On Mon, Jun 24, 2013 at 4:50 PM, Francesco Miranda kicco1...@hotmail.it wrote: Hello,I was trying to enter commands input messages or error within a routin.for example : msg (consistency error: at the time ( j : generic time ) the

Re: [R] Lexical scoping is not what I expect

2013-06-24 Thread Duncan Murdoch
On 13-06-24 4:27 PM, David Kulp wrote: According to http://cran.r-project.org/doc/contrib/Fox-Companion/appendix-scope.pdf and other examples online, I am to believe that R resolves variables using lexical scoping by following the frames up the call stack. You appear to have misread it.

Re: [R] Lexical scoping is not what I expect

2013-06-24 Thread David Kulp
Indeed, I misread / misunderstood. I think it's a difficult concept that's hard to explain and the example wasn't great. But thanks all for straightening me out! — David Kulp On Mon, Jun 24, 2013 at 6:44 PM, Duncan Murdoch murdoch.dun...@gmail.com wrote: On 13-06-24 4:27 PM, David Kulp

Re: [R] Lexical scoping is not what I expect

2013-06-24 Thread William Dunlap
I think it's a difficult concept If you pass non-global things via the argument list then you don't have to think about scoping issues so much. E.g., instead of f - function(x) { g - function(y) { y + a } a - 5 g(x) } try f - function(x) { a - 5 ; g(x, a) } g -

[R] PERT and/or CPM packages, please?

2013-06-24 Thread Erin Hodgess
Dear R People: Are there any packages for PERT or CPM analysis, please? I checked the usual places, but did not see anything. I wanted to make sure that such items do not exist before I start writing functions. Thanks in advance, Sincerely, Erin -- Erin Hodgess Associate Professor

[R] Unique matching of two sets of multidimensional data

2013-06-24 Thread Leif Kirschenbaum
Dear list, I've searched the archives and tried some code, however would appreciate some input - even a pointer in the direction of the correct function to use. Given N samples each of which is measured for characteristics x1, x2, x3,... (m ˜ 6) where each characteristic is a roughly normally

[R] Performing stats on group of observations

2013-06-24 Thread Ion Mateescu
This may be a simple problem but I spent most of my day today trying to figure it out, as I am not a programmer. I have a dataframe with observations from different weeks of the year, numbered. My variable week has values week1, week4, week9, etc. Not all weeks are represented. I need to calculate

Re: [R] Performing stats on group of observations

2013-06-24 Thread Erin Hodgess
Hi Ion: Here's something that might work for you flight.df - read.table(file=clipboard,header=TRUE) by(flight.df$NoFlights,flight.df$Week,summary) flight.df$Week: week1 Min. 1st Qu. MedianMean 3rd Qu.Max. 30.00 30.75 32.00 31.75 32.25 36.00