[R] reinstall all packages - easy way?

2014-01-09 Thread Rainer M Krug
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi is there an easy way of re-installing all packages in my user library? I am not referring to checkBuilt=TRUE, but re-install all packages, irrespective of the version. Reasoning: I installed Simons patched R for Mac to use the new C compiler, and

Re: [R] reinstall all packages - easy way?

2014-01-09 Thread Rainer M Krug
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 01/09/14, 10:35 , Berwin A Turlach wrote: G'day Rainer, Hi Berwin, On Thu, 09 Jan 2014 10:10:43 +0100 Rainer M Krug rai...@krugs.de wrote: is there an easy way of re-installing all packages in my user library? I am not referring to

Re: [R] Linear relative rate / excess relative risk models

2014-01-09 Thread Wollschlaeger, Daniel
Thanks for your suggestions! Here are links to simulated data and the Epicure syntax + reference fit: http://dwoll.de/err/dat.txt http://dwoll.de/err/epicure.log The model tested in Epicure is lambda = exp(alpha0 + alpha1*agePyr)*(1 + beta0*dosePyr*exp(beta1*agePyr)) with counts in variable

[R] DanteR problems

2014-01-09 Thread Assa Yeroslaviz
Hi, Iam trying to run the DanteR package, but keep getting some problems. I installed the Gtk 2.24 version on my mac and was able than to install the RGtk2 package and load it. After installing the DantR package I tried to load it but I keep getting strange error massages. library(DanteR);

[R] Call for papers: Geospatial Semantic Array Programming

2014-01-09 Thread Margherita Di Leo
** Apologies for any cross posting ** Earthzine http://www.earthzine.org/, an IEEE-sponsored online scientific journal, is soliciting articles of 800-3,000 words for its second quarter theme of 2014 on *Geospatial Semantic Array Programming *(GeoSemAP). We seek contributions from all regions of

Re: [R] DanteR problems

2014-01-09 Thread Patrick Burns
On 09/01/2014 10:41, Assa Yeroslaviz wrote: Hi, I am trying to run the DanteR package, but keep getting some problems. Isn't that the expected behavior? -- Patrick Burns pbu...@pburns.seanet.com twitter: @burnsstat @portfolioprobe http://www.portfolioprobe.com/blog

Re: [R] DanteR problems

2014-01-09 Thread Assa Yeroslaviz
What's that suppose to mean? Do you always expect problem when you do something? On Thu, Jan 9, 2014 at 12:11 PM, Patrick Burns pbu...@pburns.seanet.comwrote: On 09/01/2014 10:41, Assa Yeroslaviz wrote: Hi, I am trying to run the DanteR package, but keep getting some problems. Isn't

Re: [R] Levelplots with non-continuous x-axis breaks

2014-01-09 Thread Adams, Jean
Patrick, No error in your code, just two different ways of deriving a range of colors ... heat.colors() and color.scale(). I modified the code to just use color.scale(). You can tell it what two colors you want it to use for the extremes, and it will work out the shades in between. Jean #

Re: [R] DanteR problems

2014-01-09 Thread Patrick Burns
On 09/01/2014 11:18, Assa Yeroslaviz wrote: What's that suppose to mean? Do you always expect problem when you do something? Actually, yes I do always expect problems, but more pertinently it is an oblique reference to 'The R Inferno'. http://www.burns-stat.com/documents/books/the-r-inferno/

[R] Standardised Pearson residuals

2014-01-09 Thread Maria Helena Mourino Silva Nunes
Dear all, I'm using the package pscl for adjusting a Zero-Inflated Negative Binomial Regression to my data set. I would like to know if it is possible to compute the standardised Pearson residuals from the output of this package. Thanks in advanced. Best regards, Helena.

[R] Replace value in a matrix according to a list with a list of value .

2014-01-09 Thread Mohammad Tanvir Ahamed
Hi there !! I have a matrix like  mm       [,1] [,2] [,3]  [1,]    1   11   21  [2,]    2   12   22  [3,]    3   13   23 I have a list of position index like  pos $row1 [1] 1 3 $row2 [1] 3 2 $row3 [1] 1 3 2 I have a list of values like gty $v1  9  3  $v2  4  8  $v3  7  4  1   

Re: [R] Replace value in a matrix according to a list with a list of value .

2014-01-09 Thread Duncan Murdoch
On 09/01/2014 9:25 AM, Mohammad Tanvir Ahamed wrote: Hi there !! I have a matrix like mm [,1] [,2] [,3] [1,]1 11 21 [2,]2 12 22 [3,]3 13 23 I have a list of position index like pos $row1 [1] 1 3 $row2 [1] 3 2 $row3 [1] 1 3 2 I have a list of values

[R] transmission of parameters to the glmmadmb function

2014-01-09 Thread Eric Elguero
Hi everybody, I wrote a function where several variables are created, and the used in a generalized mixed model, from the glmmADMB package. here is part of the function: deleted lines where ni, spx and spy are created print(length(spy))

[R] recoding table dimensions interactively

2014-01-09 Thread Michael Friendly
Given a 3+ way table, I'd like a simple, elegant way to flatten the table to a two-way table, with some variables joined interactively to form the rows and others forming the columns. For example, starting with str(UCBAdmissions) table [1:2, 1:2, 1:6] 512 313 89 19 353 207 17 8 120 205 ...

Re: [R] Different colours for LatticeExtra graphs

2014-01-09 Thread Alvaro
Oh, thank you. Was this a mistaken reply from you? Because your link directs to yahoo mail. Al -- View this message in context: http://r.789695.n4.nabble.com/Different-colours-for-LatticeExtra-graphs-tp4683250p4683304.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] Replace value in a matrix according to a list with a list of value .

2014-01-09 Thread arun
Hi, Try: res -  do.call(rbind,lapply(seq_len(nrow(mm)),function(i) {x1 - mm[i,]; x1[pos[[i]]] - gty[[i]]; x1})) A.K. On Thursday, January 9, 2014 9:28 AM, Mohammad Tanvir Ahamed mashra...@yahoo.com wrote: Hi there !! I have a matrix like  mm       [,1] [,2] [,3]  [1,]    1   11   21  [2,]

Re: [R] Replace value in a matrix according to a list with a list of value .

2014-01-09 Thread arun
Hi, You may also try: vec1 - (seq(nrow(mm))-1)*ncol(mm) pos2 - unlist(mapply(+,pos,vec1)) mm1 - t(mm) mm1[pos2] - unlist(gty) identical(res,t(mm1)) #[1] TRUE A.K. On Thursday, January 9, 2014 9:40 AM, arun smartpink...@yahoo.com wrote: Hi, Try: res - 

Re: [R] Levelplots with non-continuous x-axis breaks

2014-01-09 Thread Pachapep
Great, it works perfectly! Thanks so much for the awesome help! (Happy) patrick On Jan 9, 2014, at 7:07, Adams, Jean jvad...@usgs.gov wrote: Patrick, No error in your code, just two different ways of deriving a range of colors ... heat.colors() and color.scale(). I modified the code to

Re: [R] recoding table dimensions interactively

2014-01-09 Thread William Dunlap
Do you just want to change how the rows and columns of ftable's output are labelled? If so, the following may do what you want: it produces a matrix with dimnames based on the row.vars and col.vars attributes of ftable's output. f - function(ftable) { makeDimNamesEl - function(x) {

Re: [R] recoding table dimensions interactively

2014-01-09 Thread Hadley Wickham
Hi Michael, It's pretty easy with reshape: library(reshape2) ucbm - melt(UCBAdmissions) acast(ucbm, Admit + Gender ~ Dept) acast(ucbm, Admit ~ Dept + Gender) acast(ucbm, Admit + Dept + Gender ~ .) # You can also do aggregations acast(ucbm, Admit ~ Dept, fun = sum) Hadley On Thu, Jan 9, 2014

Re: [R] Implementing A Formula

2014-01-09 Thread MacQueen, Don
The phrase, need to go row by row plugging this formula in to only take data from that individual row suggests a spreadsheet-like concept. But R does not work the way a spreadsheet does. Given the example data and function that Frede provided (thank you!), a simple, and probably the most basic,

Re: [R] tt() function (was Package dependencies in building R packages)

2014-01-09 Thread Terry Therneau
On 12/31/2013 05:00 AM, r-help-requ...@r-project.org wrote: Thanks for your kind response Duncan. To be more specific, I'm using the function mvrnorm from MASS. The issue is that MASS depends on survival and I have a function in my package named tt() which conflicts with a function in survival

Re: [R] Best practices for loading large datasets into R

2014-01-09 Thread Greg Snow
You have made a good first start by keeping your data in a database (it would be even slower if you read it in from a text file each time). The first suggestion is to not read in all the data, just bring in what you need. For early steps, exploring the data, getting a feel for what you want to

Re: [R] Numerical solution

2014-01-09 Thread Greg Snow
?uniroot ?optim ?optimize and look at the Optimization and Mathematical Programming task view on CRAN. On Wed, Jan 8, 2014 at 8:55 PM, Aurélien Philippot aurelien.philip...@gmail.com wrote: Dear R experts, I want to use numerical methods to solve a complex problem. Here is a very simple

[R] Unable to Install a package from source in Windows

2014-01-09 Thread Ravi Varadhan
Hi, I am using following R version: version _ platform i386-w64-mingw32 arch i386 os mingw32 system i386, mingw32 status major 3 minor 0.1 year 2013 month 05 day16 svn rev62743 language

Re: [R] Error in t.test

2014-01-09 Thread arun
Hi Vivek, res1 - read.table(positve-res1.txt,header=TRUE)  dim(res1) #[1] 5292    4 #You could simplify the first loop as: mean_Res2 - as.vector(rowMeans(res1))  identical(mean_Res1,mean_Res2) #[1] TRUE ##Regarding the second loop: pval_r2 - as.vector(apply(res1,1,function(x)

[R] Having a problem with labels

2014-01-09 Thread Jeff Johnson
Hi, I'm having a problem with my labels. I am reading in a data file: df - read.csv(file = 'batch1extract_100k_sample.csv') However, it's producing two sets of labels: labels(df) [[1]] [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 [22] 22 23 24 25 26 27 28 29 30 31 32 33

Re: [R] Having a problem with labels

2014-01-09 Thread Rui Barradas
Hello, According to the help page for ?labels, for a data.frame it's simply the dimnames, meaning, the row names (your numbers) and the column names. Note that read.csv returns a data.frame, not a matrix, and data frames allways have row names, typically numbers. I wouldn't worry about it.

Re: [R] Having a problem with labels

2014-01-09 Thread Sarah Goslee
Hi Jeff, If you read the help for labels(), it says that for a dataframe it returns the dimnames: the first component is the row names, which by default are numbers, and the second component of the list is the column names. Since you appear to want just the latter, you could use colnames(df)

Re: [R] Unable to Install a package from source in Windows

2014-01-09 Thread Henrik Bengtsson
The answer most likely is in the message: '\\homer.win.ad.jhu.edu\users$\rvaradh1\Documents' CMD.EXE was started with the above path as the current directory. UNC paths are not supported. Defaulting to Windows directory. That path starting with a \\ is a *UNC path* (a Windows thing), which I

Re: [R] recoding table dimensions interactively

2014-01-09 Thread Michael Friendly
Thanks for this, Bill Your solution does just what I want. In fact, it qualifies as the missing as.matrix() method for n-way tables arranged with ftable(), or vcd::structable(), which does provide an as.matrix() method, but omits the names and dimnames. Here it is, renamed and using _ as

Re: [R] Unable to Install a package from source in Windows

2014-01-09 Thread Henrik Bengtsson
On Thu, Jan 9, 2014 at 11:04 AM, Henrik Bengtsson h...@biostat.ucsf.edu wrote: The answer most likely is in the message: '\\homer.win.ad.jhu.edu\users$\rvaradh1\Documents' CMD.EXE was started with the above path as the current directory. UNC paths are not supported. Defaulting to Windows

Re: [R] Numerical solution

2014-01-09 Thread Rolf Turner
On 10/01/14 07:00, Greg Snow wrote: ?uniroot ?optim ?optimize The OP will have to be careful and clever. Specifying the *intervals* over which uniroot() and optimise() search is going to be problematic, it seems to me. and look at the Optimization and Mathematical Programming task

Re: [R] transmission of parameters to the glmmadmb function

2014-01-09 Thread David Winsemius
On Jan 9, 2014, at 9:47 AM, Eric Elguero wrote: Hi everybody, I wrote a function where several variables are created, and the used in a generalized mixed model, from the glmmADMB package. here is part of the function: deleted lines where ni, spx and spy are created print(length(spy))

[R] convert real valued matrix to binary matrix

2014-01-09 Thread email
Hi: I am trying to analyze an yeast gene expression data http://arep.med.harvard.edu/biclustering/yeast.matrix I need to convert the real-valued data matrix to a binary (0,1) matrix. Is there any package available? How can it be done? Thanks: John

Re: [R] looping through 3D array

2014-01-09 Thread arun
Hi, Try: library(emdist) set.seed(435) results- array(sample(1:400,120,replace=TRUE),dim=c(10,3,4)) res - sapply(seq(dim(results)[1]),function(i) {x1 - results[i,,]; x2 - results; sapply(seq(dim(x2)[1]),function(i) emd2d(x1,x2[i,,]))}) dim(res) #[1] 10 10 A.K. On Thursday, January 9, 2014

Re: [R] looping through 3D array

2014-01-09 Thread arun
Hi, No problem. You can use ?lower.tri() or ?upper.tri() res[lower.tri(res)] res[lower.tri(res,diag=TRUE)] #Other way would be to use: ?combn indx - combn(dim(results)[1],m=2) res2 - sapply(seq_len(ncol(indx)),function(i) {x1 - indx[,i]; emd2d(results[x1[1],,],results[x1[2],,]) })  

Re: [R] convert real valued matrix to binary matrix

2014-01-09 Thread Bert Gunter
Why? You lose information in doing so, do you not? I also think you might do better posting to the Bioconductor list, as they are specifically concerned with such matters. Cheers, Bert Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 Data is not information. Information is not

Re: [R] Function inside Sweave

2014-01-09 Thread Duncan Mackay
Hi Silvano I am not sure exactly what you want as I am not sure of the structure and format going into xtable but the structure after you have formed the table is apparently the same structure. This is what I suggested before (modified) for(j in 1:25){ yourtable - ... xx - xtable(yourtable)

Re: [R] with() and within() functions inside lapply() not seeing outside of its environment?

2014-01-09 Thread Pavel N. Krivitsky
Hi, I wouldn't call it a bug, but it's a documented limitation, if you know how to read it. As documented, the expression is evaluated with the caller's environment as the parent environment. But here the caller is some code in lapply, not your function f. x is not found there. Thanks!

Re: [R] subsetting 3D array

2014-01-09 Thread arun
Hi Alex, Try: set.seed(345) results- array(sample(-5:5,120,replace=TRUE),dim=c(10,3,4)) indx - !!apply(results,1,sum) library(plyr) results2 - laply(lapply(seq(dim(results)[1]),function(i) results[i,,])[indx],identity) attr(results2,dimnames) - NULL  dim(results2) #[1] 9 3 4 A.K. I have a 3D

Re: [R] subsetting 3D array

2014-01-09 Thread Bert Gunter
Just use apply() and indexing instead! results[,,apply(results,3,sum)TRUE] ## will do it. However, note that numerical error may make a hash of this. So safer would be something like: eps - 1e-15 ## i.e. something small results[,,abs(apply(results,3,sum))eps] Cheers, Bert Bert Gunter

Re: [R] subsetting 3D array

2014-01-09 Thread arun
I figured it out: dim(results[apply(results,1,sum)TRUE,,]) #[1] 9 3 4 A.K. On , arun smartpink...@yahoo.com wrote: dim(results[,,apply(results,3,sum)TRUE]) #[1] 10  3  4 dim(results[,,abs(apply(results,3,sum))eps]) #[1] 10  3  4  dim(results2) #[1] 9 3 4 A.K. On Friday, January 10, 2014

[R] using lapply to get function values

2014-01-09 Thread Long Vo
Hi R users, I need to apply a function on a list of vectors. This is simple when I use functions that returns only one numerical value such as 'mean' or 'variance'. Things get complex when I use functions returning a list of value, such as 'acf'. In the following example I first create a list of

[R] locate pattern in matrix

2014-01-09 Thread email
Dear all, I have a binary matrix 0 0 0 0 0 1 1 1 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 1 1 I want to find the location of all the square and rectangular 1 blocks, like First block in row=2, col=1 to row=3, col=3. Second block in row=5, col=4, to row=6, col=5. How can I find such blocks of

[R] GA optimization in two dimensions

2014-01-09 Thread email
Hi: I am trying to implement a bandwidth reduction algorithm for a (M x N) binary matrix using the GA package in R. I am using the folloging code to get the optimal permutation for rows and columns (optimization in two dimensions). M - matrix(c(0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1,