Re: [R] Subset by Factor by date

2008-06-14 Thread T.D.Rudolph
I can't speak to the intricacies of the formula but when I run the ByDataFrame() function provided on a subsample of my data (n=50) it returned only the very first id value in the output; the rest came out as NA This is not to say it has not properly selected the rows with min(x$diff), but I

Re: [R] Sweave: looping over mixed R/LaTeX code

2008-06-14 Thread Dieter Menne
Stephan Kolassa Stephan.Kolassa at gmx.de writes: I would like to loop over a medium amount of Sweave code, including both R and LaTeX chunks. Is there any way to Stephan noted that \newcommand was not expanded, so after re-reading I realized that my comment was a bit short. After all, when

[R] Book on R graphics

2008-06-14 Thread Marcin Kozak
Hi all, I am looking for a book from which one could learn a wide range of graphics in R, from the very beginning topics to those advanced (though not necessarily concerned with a particular method or topic). I don't look for a list of such books since this is on R's web page, I am rather

[R] SLLN for loggamma fails for 2 order moments

2008-06-14 Thread michaelhk82
Hi. I was trying to calculate 2. order moment for a loggamma sample. Also, I checked it with the function mlgamma from the package actuar, which calculates moments based on loggamma parameters. Se below - I get big deviations. Numerical integration suggests that mlgamma gets it right. What fails

Re: [R] Problem with Freq function {prettyR}

2008-06-14 Thread Jim Lemon
[EMAIL PROTECTED] wrote: ... I have a problem with freq from prettyR. Please have a look at my syntax with a litte example: library(prettyR) #Version 1 test.df-data.frame(q1=sample(1:4,8,TRUE), gender=sample(c(f,m),8,TRUE)) test.df freq(test.df) #No error message #Version 2

Re: [R] Problem with Freq function {prettyR}

2008-06-14 Thread ukoenig
Thank you Jim, the error message appeared, as I tried to run an example from the wonderful script „R for SAS and SPSS Users“ written by Bob Muenchen (p. 76): http://oit.utk.edu/scc/RforSASSPSSusers.pdf This is the code on page 76: # Frequencies percents using the freq function # from the

[R] How to see data for a package built under Windows

2008-06-14 Thread Gillian Raab
I have followed the instructions on how to build a Windows package and everything seems to work EXCEPT that I can't see the data files that I have loaded into the data directory. I have placed the appropriate data in the data directory (as in the instructions). There are 3 data sets, which I can

Re: [R] How to see data for a package built under Windows

2008-06-14 Thread John Fox
Dear Gillian, Unless you add the directive LazyData: yes to the package DESCRIPTION file, you'll need to use the data() command to access the data in the package -- e.g., data(Mowatt). I hope this helps, John -- John Fox, Professor Department of Sociology

Re: [R] Subset by Factor by date

2008-06-14 Thread Charilaos Skiadas
On Jun 14, 2008, at 2:59 AM, T.D.Rudolph wrote: I can't speak to the intricacies of the formula but when I run the ByDataFrame() function provided on a subsample of my data (n=50) it returned only the very first id value in the output; the rest came out as NA This is not to say it has

Re: [R] Book on R graphics

2008-06-14 Thread Roberto Laforgia
See the following link: http://www.amazon.com/Graphics-Computer-Science-Data-Analysis/dp/158488486X/ref=wl_itt_dp?ie=UTF8coliid=I3TIYS7LRDPIEDcolid=1ZQCB91VGW5UR Regards, R.L. Marcin Kozak wrote: Hi all, I am looking for a book from which one could learn a wide range of graphics in R,

Re: [R] strsplit, keeping delimiters

2008-06-14 Thread hadley wickham
On Sat, Jun 14, 2008 at 12:55 AM, Gabor Grothendieck [EMAIL PROTECTED] wrote: Try this: library(gsubfn) x - A: 123 B: 456 C: 678 strapply(x, [^ :]+[ :]|[^ :]+$) [[1]] [1] A: 123 B: 456 C: 678 and check out the gsubfn home page at: http://gsubfn.googlecode.com Thanks Gabor!

Re: [R] strsplit, keeping delimiters

2008-06-14 Thread Martin Morgan
hadley wickham [EMAIL PROTECTED] writes: n On Sat, Jun 14, 2008 at 12:55 AM, Gabor Grothendieck [EMAIL PROTECTED] wrote: Try this: library(gsubfn) x - A: 123 B: 456 C: 678 strapply(x, [^ :]+[ :]|[^ :]+$) [[1]] [1] A: 123 B: 456 C: 678 Also strsplit(x, (?=[0-9:] ), perl=TRUE)

[R] modifying INSTALL to make html but not build package

2008-06-14 Thread Jonathan Baron
For my R page at http://finzi.psych.upenn.edu/ (also the target of RSiteSearch()), I'm trying to find a way to get the html versions of the help pages without actually installing packages. This will allow me to include packages that don't install. And it will also vastly speed up the monthly

Re: [R] strsplit, keeping delimiters

2008-06-14 Thread hadley wickham
On Sat, Jun 14, 2008 at 10:20 AM, Martin Morgan [EMAIL PROTECTED] wrote: hadley wickham [EMAIL PROTECTED] writes: n On Sat, Jun 14, 2008 at 12:55 AM, Gabor Grothendieck [EMAIL PROTECTED] wrote: Try this: library(gsubfn) x - A: 123 B: 456 C: 678 strapply(x, [^ :]+[ :]|[^ :]+$) [[1]] [1]

Re: [R] cluster.stats

2008-06-14 Thread Laura Poggio
Thank you very much for your answer. I tried to run the function on my data and now I am getting this message of error Error in as.dist(dmat[clustering == i, clustering == i]) : (subscript) logical subscript too long Below the code I am using (version2.7.0 of R with all packages updated): data

Re: [R] False convergence in LME

2008-06-14 Thread Spencer Graves
This is a common problem, for which solutions are poorly documented. 1. Have you tried fitting simpler models, in the hopes of getting something that converges without complaint, then use 'update' to try more complicated models? It sometimes works, though often not.

Re: [R] Book on R graphics

2008-06-14 Thread Spencer Graves
The first three chapters of Paul Murrell (2006) R Graphics (Chapman Hall), which Marcin cited, provides a very detailed and useful overview of traditional graphics in R. The rest of the book is devoted to 'lattice' and 'grid' graphics; unfortunately, I have so far not been able to

Re: [R] strsplit, keeping delimiters

2008-06-14 Thread Gabor Grothendieck
On Sat, Jun 14, 2008 at 11:46 AM, hadley wickham [EMAIL PROTECTED] wrote: On Sat, Jun 14, 2008 at 10:20 AM, Martin Morgan [EMAIL PROTECTED] wrote: hadley wickham [EMAIL PROTECTED] writes: n On Sat, Jun 14, 2008 at 12:55 AM, Gabor Grothendieck [EMAIL PROTECTED] wrote: Try this:

Re: [R] cluster.stats

2008-06-14 Thread Christian Hennig
The given information is not enough to tell you what's going on. as.dist doesn't appear in the given code and it's not clear to me what kind of object img is (a small image doesn't tell me what R makes of it). Also, try to read the help pages first and find out whether img is of the format that

Re: [R] cluster.stats

2008-06-14 Thread Laura Poggio
I am sorry I did not provide enough information. I am not using img later, but data that is data.frame. I wrote that img is a image just to explain what kind of data is coming from, but the object I am using is data and it is a data.frame (checked many times). I am not using as.dist, but dist in

Re: [R] cluster.stats

2008-06-14 Thread Laura Poggio
Thank. See below. Laura 2008/6/14 Christian Hennig [EMAIL PROTECTED]: What does str(ddata) give? Class 'dist' atomic [1:130816] 69.2 117.1 145.6 179.9 195.6 ... dcent doesn't make sense as input for cluster.stats, because you need a dissimilarity matrix between all objects. Yes I

Re: [R] modifying INSTALL to make html but not build package

2008-06-14 Thread Jonathan Baron
I have found the problem. I don't understand it, but the script works now. I've removed it from where it was but will send it to anyone who wants it. Jon On 06/14/08 11:44, Jonathan Baron wrote: For my R page at http://finzi.psych.upenn.edu/ (also the target of RSiteSearch()), I'm trying to

Re: [R] cluster.stats

2008-06-14 Thread Christian Hennig
Dear Laura, I have R 2.6.0. I tried dist on a vector of length 200,000 and it told me that it is too long. Theoretically, if you have 260,000 observations, the length of the dist object should be 260,000*259,999/2, which is too large for our computers, I guess. Which means that unfortunately

Re: [R] cluster.stats

2008-06-14 Thread Laura Poggio
Thank you very much for all the info and support. Now I managed to make it working on a small subset of the original data set. I think that the first error message I got (Error in as.dist(dmat[clustering == i, clustering == i]) : (subscript) logical subscript too long) is generated when the 2

Re: [R] False convergence in LME

2008-06-14 Thread Andrew Robinson
These are great tips from Spencer. The other thing that I have found useful is to use a different optimizing algorithm. You can do this by: control=lmeControl(opt = optim) Good luck! Andrew On Sat, Jun 14, 2008 at 09:45:22AM -0700, Spencer Graves wrote: This is a common problem, for

Re: [R] Correcting the display of colnames and rownames

2008-06-14 Thread jim holtman
Here is an approach that should work: x - data.frame(a=1:10, b=1:10, c=1:10) # use sprintf to make consistent numbers myNames - sprintf(%.2f, seq(from=-179, to=179, length=3)) colnames(x) - myNames x -179.00 0.00 179.00 111 1 222 2 333 3

[R] restricted coefficient and factor in linear regression.

2008-06-14 Thread Oh Dong-hyun
Hi, my data set is data.frame(id, yr, y, l, e, k). I would like to estimate Lee and Schmidts (1993, OUP) model in R. My colleague wrote SAS code as follows: ** procedures for creating dummy variables are omitted ** ** di# and dt# are dummy variables for industry and time ** data a2; merge a1

[R] plotting regression line

2008-06-14 Thread **linda**
Hello, I'm trying to plot an exponential regression line through my data (scatterplot with trend line), but can't find a way to do that. it is to be the best fit possible. -- View this message in context: http://www.nabble.com/plotting-regression-line-tp17837683p17837683.html Sent from the R

Re: [R] Output of silhouette (cluster package)

2008-06-14 Thread Martin Maechler
CV == Cristiano Varin [EMAIL PROTECTED] on Fri, 13 Jun 2008 11:31:34 +0200 writes: CV Dear R users, I am mailing you about the graphical CV output of silhouette (cluster package) CV From the example of silhouette in help(silhouette): ar - agnes(ruspini) si3 -

[R] cbind'ing multivariate ts objects

2008-06-14 Thread Андрей Парамонов
I use R 2.7.0 on GNU/Linux. I have noticed a problem in cbind method for multivariate time series (ts) objects. Consider the following example: t - ts(data.frame(a = 10:20, b = 20:30, c = 30:40, d = 40:50)) t1 - t[, c('a', 'b')] t2 - t[, c('c', 'd')] colnames(t1) [1] a b colnames(t2) [1] c

[R] qt with ncp37.62

2008-06-14 Thread [EMAIL PROTECTED]
help(qt) states that: ncpnon-centrality parameter delta; currently except for rt(), only for abs(ncp) = 37.62 so I would expect that calling qt with non-centrality parameter exceeding 37.62 should fail, instead e.g. calling mapply(function(x) qt(p = 0.9, df = 55, ncp = x),35:45) gives:

[R] how to select out some columns using cbind()

2008-06-14 Thread ss
Hello! I have a matrix: dim(data1) [1] 34176 581 of 34176 rows and 581 columns, I want to make a new matrix data2 by taking the 2nd column, 9th column, 16th column the column number is in the order of: 2 9 (2+7) 16 (9+7) 23 (16+7) ... the new matrix data2 should include 83 columns, is

Re: [R] how to select out some columns using cbind()

2008-06-14 Thread jim holtman
newdata1 - data1[, seq(from=2, to=ncol(data1), by=7)] On Sat, Jun 14, 2008 at 7:27 PM, ss [EMAIL PROTECTED] wrote: Hello! I have a matrix: dim(data1) [1] 34176 581 of 34176 rows and 581 columns, I want to make a new matrix data2 by taking the 2nd column, 9th column, 16th column

Re: [R] cbind'ing multivariate ts objects

2008-06-14 Thread jim holtman
Is this what you want: t - ts(data.frame(a = 10:20, b = 20:30, c = 30:40, d = 40:50)) t1 - t[, c('a', 'b')] t2 - t[, c('c', 'd')] colnames(t1) [1] a b colnames(t2) [1] c d x - cbind(t1, t2) colnames(x) [1] t1.a t1.b t2.c t2.d colnames(x) - sub(^.*\\., , colnames(x)) x Time Series:

Re: [R] how to select out some columns using cbind()

2008-06-14 Thread ss
Thank you very much, Jim! Have a good evening! Allen On Sat, Jun 14, 2008 at 7:35 PM, jim holtman [EMAIL PROTECTED] wrote: newdata1 - data1[, seq(from=2, to=ncol(data1), by=7)] On Sat, Jun 14, 2008 at 7:27 PM, ss [EMAIL PROTECTED] wrote: Hello! I have a matrix: dim(data1) [1] 34176

Re: [R] plotting regression line

2008-06-14 Thread David Arnold
Linda, Been working on that: http://msenux.redwoods.edu/mathdept/R/TransformingData.php Along with some other activities: http://msenux.redwoods.edu/mathdept/R/index.php David Arnold http://online.redwoods.edu/instruct/darnold On Jun 14, 2008, at 2:51 AM, **linda** wrote: Hello, I'm

Re: [R] SLLN for loggamma fails for 2 order moments

2008-06-14 Thread G. Jay Kerns
Dear Michael, The SLLN hasn't failed. :-)In this particular example, it looks like the sample means are simply converging at a rate which is slower than desired. Unfortunately, your particular loggamma doesn't have a finite fourth moment; so you don't have the usual (worst case) convergence