[R] Error in ginv(A) : 'X' must be a numeric or complex matrix

2015-06-14 Thread Matteo Villa
Dear all, I encountered a problem that has been bugging me for some hours now, and I still can't come up with a viable solution. I tried searching the archives, but to no avail, so here I am sending my first e-mail to the list! I am estimating a binary spatial autoregressive model via a Gibbs samp

Re: [R] Creating list with increasing string lengths

2015-06-14 Thread Jim Lemon
Hi Nia, Many ways to do something like this, for example: N<-6 sapply(1:N,function(x) return(sample(1:10,x,TRUE))) I'll let you work out how to generalize this. Jim On Sun, Jun 14, 2015 at 3:06 PM, Bert Gunter wrote: > Is this homework? Homework is deprecated here. > > ?lapply > > is one of m

Re: [R] R 3.2, Mac 10.10.3 : help.search showing error

2015-06-14 Thread David Winsemius
On Jun 13, 2015, at 11:04 PM, Berend Hasselman wrote: > >> On 14-06-2015, at 06:25, Ramnik Bansal wrote: >> >> Thanks. But it seems to be an R 3.2.0 specific problem. >> > > I replied with the following to a similar message on R-devel. There was no error either with using help() or using th

Re: [R] Help with abs function

2015-06-14 Thread Andrés Aragón Martínez
Hi, Just do the following: > tran<-c(7.2) > tgrid<-c(7.1,7.4,7.3,7.1,7.3) > tgrid<-tgrid-tran > tgrid [1] -0.1 0.2 0.1 -0.1 0.1 > abs(tgrid[tgrid>0.1]) [1] 0.2 Andrés > El 12/06/2015, a las 11:01, Jeff Newmiller > escribió: > > FAQ 7.31 > ---

[R] most frequent value

2015-06-14 Thread Ragia Ibrahim
Dear group, I have the following integer object > a 3 4 6 3 3 6 how to get the most frequent value (it should be 3) and get nothing if no frequent one and all is equal 3 4 6 3 4 6 Thanks in advance Ragia [[alternative HTML version deleted

Re: [R] most frequent value

2015-06-14 Thread Jim Lemon
Hi Ragia, The basic method is to use "table" and examine the result: > a<-matrix(c(3,3,4,3,6,6),nrow=2) > b<-matrix(c(3,3,4,4,6,6),nrow=2) > table(a) a 3 4 6 3 1 2 but you can get the modal value directly like this: library(prettyR) Mode(a) [1] "3" Mode(b) [1] ">1 mode" Jim On Mon, Jun 15, 201

Re: [R] matrix/df help populate NA

2015-06-14 Thread jim holtman
Is this what you want: > x1 = structure(list(Subject = c("x1", "x2"), A = c(1.5, -1.2), B = c(-1.3, + -0.3), C = c(0.4, 0.3), D = c(-0.2, -0.1)), .Names = c("Subject", + "A", "B", "C", "D"), class = "data.frame", row.names = c(NA, + -2L)) > > x2 = structure(list(Subject = c("x1", "x2"), A = c(4.3,

Re: [R] Scatterplot : smoothing colors according to density of points

2015-06-14 Thread jim holtman
check out the 'hexbin' package for making scatter plots that have a lot of points overlapping in a small area. Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Tue, Jun 2, 2015 at 9:51 AM, Adams, Jean wrot

Re: [R] Milisecond problem in as.POSIXct ?

2015-06-14 Thread Joshua Ulrich
On Wed, Jun 10, 2015 at 8:05 PM, Joshua Ulrich wrote: > > This is known behavior with how POSIXt objects are printed. See the > discussion on StackOverflow: > http://stackoverflow.com/questions/7726034/how-r-formats-posixct-with-fractional-seconds > To summarize the relevant portion of the disc

Re: [R] Different behavior of model.matrix between R 3.2 and R3.1.1

2015-06-14 Thread Frank Harrell
Terry - your example didn't demonstrate the problem because the variable that interacted with strata (zed) was not a factor variable. But I had stated the problem incorrectly. It's not that there are too many strata terms; there are too many non-strata terms when the variable interacting with

Re: [R] matrix/df help populate NA

2015-06-14 Thread Adrian Johnson
Thank you very much. It worked! On Sun, Jun 14, 2015 at 8:00 PM, jim holtman wrote: > Is this what you want: > >> x1 = structure(list(Subject = c("x1", "x2"), A = c(1.5, -1.2), B = c(-1.3, > + -0.3), C = c(0.4, 0.3), D = c(-0.2, -0.1)), .Names = c("Subject", > + "A", "B", "C", "D"), class = "dat