Re: [R] inserting text lines in a dat frame

2008-02-06 Thread Richard . Cotton
I am trying to prepare a bed file to load as accustom track on the UCSC genome browser. I have a data frame that looks like the one below. x V1V2 V3 1 chr1 11255 55 2 chr1 11320 29 3 chr1 11400 45 4 chr2 21680 35 5 chr2 21750 84 6 chr2 21820 29 7 chr2 31890 46 8 chr3 32100

Re: [R] Incomplete ouput with sink and split=TRUE

2008-02-06 Thread Alex Brown
you could use the unix function 'script' before invoking the R interpreter. example session: $ script Script started, file is typescript [x86_64|[EMAIL PROTECTED]:~] $ R --quiet --vanilla 1:10 [1] 1 2 3 4 5 6 7 8 9 10 q() [x86_64|[EMAIL PROTECTED]:~] $ exit exit Script done, file

Re: [R] Histogram/Bar plot graph

2008-02-06 Thread ONKELINX, Thierry
You'll need to transform your dataset in a long format first. library(ggplot2) n - 5 MyValues - data.frame(Gene = factor(LETTERS[seq_len(n)]), ES = rnorm(n), MEF = rnorm(n), Embrio = rnorm(n), EShyp = rnorm(n)) MyValuesMelt - melt(MyValues, id.var = Gene) ggplot(MyValuesMelt, aes(x = Gene, y =

Re: [R] Histogram/Bar plot graph

2008-02-06 Thread Senthil Kumar M
On Feb 6, 2008 2:35 AM, ONKELINX, Thierry [EMAIL PROTECTED] wrote: You'll need to transform your dataset in a long format first. library(ggplot2) n - 5 MyValues - data.frame(Gene = factor(LETTERS[seq_len(n)]), ES = rnorm(n), MEF = rnorm(n), Embrio = rnorm(n), EShyp = rnorm(n)) MyValuesMelt

Re: [R] inserting text lines in a dat frame

2008-02-06 Thread jim holtman
Try this and see if it is what you want: x - read.table(textConnection( V1V2 V3 1 chr1 11255 55 2 chr1 11320 29 3 chr1 11400 45 4 chr2 21680 35 5 chr2 21750 84 6 chr2 21820 29 7 chr2 31890 46 8 chr3 32100 29 9 chr3 52380 29 10 chr3 66450 46 ), header=TRUE) cat(browser position

Re: [R] error message from apply()

2008-02-06 Thread jim holtman
Is 'thr' supposed to be the mean and sd of all the values in data2_1? If so, then thr - mean(data2_1, na.rm=TRUE) + sd(data2_1,na.rm=TRUE) I am not exactly sure of what is the problem that you are trying to solve. You just have to make sure that the object you are creating by precomputing has

[R] Multivariate Maximum Likelihood Estimation

2008-02-06 Thread Konrad BLOCHER
Hi, I am trying to perform Maximum Likelihood estimation of a Multivariate model (2 independent variables + intercept) with autocorrelated errors of 1st order (ar(1)). Does R have a function for that? I could only find an univariate option (ar.mle function) and when writing my own I find that it

Re: [R] How to search for packages - wrap up!

2008-02-06 Thread Neil Shephard
Charilaos Skiadas-3 wrote: On Feb 5, 2008, at 10:37 AM, Monica Pisica wrote: But perhaps I am missing something very obvious? I thought the task views were located where they are (linked from the page that lists packages) as they summarise the available packages for the given topic.

Re: [R] How to search for packages - wrap up!

2008-02-06 Thread Charilaos Skiadas
On Feb 6, 2008, at 6:23 AM, Neil Shephard wrote: Charilaos Skiadas-3 wrote: On Feb 5, 2008, at 10:37 AM, Monica Pisica wrote: But perhaps I am missing something very obvious? I thought the task views were located where they are (linked from the page that lists packages) as they

Re: [R] Effect size of comparison of two levels of a factor in multiple linear regression

2008-02-06 Thread Christoph Mathys
On Feb 4, 08:49 AM, Chuck Cleland wrote: On 2/3/2008 10:09 AM, Christoph Mathys wrote: Dear R users, I have a linear model of the kind outcome ~ treatment + covariate where 'treatment' is a factor with three levels (0, 1, and 2), and the covariate is continuous. Treatments 1 and 2 both have

Re: [R] Multivariate Maximum Likelihood Estimation

2008-02-06 Thread Gavin Simpson
hits=-2.6 tests=BAYES_00 X-USF-Spam-Flag: NO On Wed, 2008-02-06 at 12:45 +0100, Konrad BLOCHER wrote: I get this message: Error: could not find function gls (and also) Error: could not find function lm.gls Which package is that in? RSiteSearch(gls, restrict = functions) Tells you the

Re: [R] How to search for packages - wrap up!

2008-02-06 Thread Neil Shephard
I'm not sure that this would make any difference to someone considering using R. Would they know what CRAN stands for? Probably not unless they've used CPAN or equivalent in the past. Would they know what a 'Task View' is? Again probably not as its not patently obvious what it is, it doesn't

Re: [R] advice requested re: building good system (R, SQL db) for handling large datasets

2008-02-06 Thread Rainer M Krug
With databases, one issue that might be relevant is whether you want to store data in tables (e.g. one table to store one data.frame) that can subsequently be manipulated in the DB, or to store R objects as R objects (e.g. as BLOBs). My situation is likely to be the later case, and one of my

Re: [R] How to form a simple R package

2008-02-06 Thread Doran, Harold
Well, not exactly. package.skeleton() is very useful as a first step, but it does *not* create a package entirely. It turns out that in Windows, creating a package is very simple once you have downloaded all programs needed (e.g., perl) and you have your path configured exaclty, (exactly, exactly)

Re: [R] How to search for packages - wrap up!

2008-02-06 Thread hadley wickham
A new user will come to the R homepage, go to CRAN via the link under download and from there see Packages and then be swamped by the huge number available. Having Task Views as a link on the R homepage would make these more visible. I would think that a new user would see the download

Re: [R] Mixed models quantile regression

2008-02-06 Thread roger koenker
There is no generally agreed upon notion of random effects for quantile regression applications. Insofar as one is willing to accept the idea that random effects are just shrunken fixed effects one can consider similar schemes in the QR context; one such is described in “Quantile Regression

Re: [R] Incomplete ouput with sink and split=TRUE

2008-02-06 Thread Duncan Murdoch
On 2/5/2008 11:12 AM, jiho wrote: Dear List, I am trying to get R's terminal output to a file and to the terminal at the same time, so that I can walk through some tests and keep a log concurrently. The function 'sink' with the option split=TRUE seems to do just that. It works fine

[R] counting row repetitions without loop

2008-02-06 Thread Waterman, DG (David)
Hi, I have a data frame consisting of coordinates on a 10*10 grid, i.e. example x y 1 4 5 2 6 7 3 6 6 4 7 5 5 5 7 6 6 7 7 4 5 8 6 7 9 7 6 10 5 6 What I would like to do is return an 10*10 matrix consisting of counts at each position, so in the above example

[R] axis help

2008-02-06 Thread [EMAIL PROTECTED]
Hi, i'm having trouble with my x and y axis. The commands i'm using are below. The problem is that the y axis starts at coordinate 0,1 and the x axis starts at coordinate 0,0. As far as I know the y axis can't start at 0 (because it's log scaled) ,so I would like to position the x

Re: [R] How to generate table output of t-test

2008-02-06 Thread John Kane
There may be an easier way but you can extract the desired values from the list values in t str(t) to see the elements in t. test - matrix(c(1, 1,2,2), 2,2) tt - apply(test, 1, t.test) ttable - function(tlist) { tframe - data.frame(NULL) for(i in 1:length(tlist)){ t.value - tlist[[i]][1]

[R] wilderSum

2008-02-06 Thread Shubha Vishwanath Karanth
Hi, Can somebody tell me the formula for ?wilderSum in TTR package? I mean how are these calculated? BR, Shubha Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com This

Re: [R] R-Commander - pie charts menu blinded out

2008-02-06 Thread Peter Dalgaard
John Fox wrote: Dear Peter and Iksmax, To elaborate slightly, the Rcmdr tries to figure out which menu items are appropriate in a given context, and as Peter says, requires that you have at least one factor in the active dataset before activating the pie chart menu item; only factors will be

Re: [R] help with oop in R - class structure and syntex

2008-02-06 Thread tom soyer
Thanks Gabor for illustrating the basics oop in R using S3. Maybe I didn't have the right documents, but you example taught me more about oop in R than everything else I read combined! Thanks for the tip on R.oo, I plan to check it out later. I have a few followup questions... (1) how do I

Re: [R] Incomplete ouput with sink and split=TRUE

2008-02-06 Thread jiho
On 2008-February-06 , at 14:45 , Duncan Murdoch wrote: On 2/5/2008 11:12 AM, jiho wrote: Dear List, I am trying to get R's terminal output to a file and to the terminal at the same time, so that I can walk through some tests and keep a log concurrently. The function 'sink' with the

Re: [R] counting row repetitions without loop

2008-02-06 Thread James Foadi
On Wednesday 06 February 2008 14:08, Waterman, DG (David) wrote: Hi, I have a data frame consisting of coordinates on a 10*10 grid, i.e. example x y 1 4 5 2 6 7 3 6 6 4 7 5 5 5 7 6 6 7 7 4 5 8 6 7 9 7 6 10 5 6 What I would like to do is return

Re: [R] counting row repetitions without loop

2008-02-06 Thread Doran, Harold
I think this does what you want, but there may be a more efficient way x y 4 5 6 7 6 6 7 5 5 7 6 7 4 5 6 7 7 6 5 6 dat - read.table('clipboard', header=TRUE) # copy sample data above dat$patt - paste(dat$x,dat$y, sep='') mm - as.data.frame(with(dat, table(patt))) dat - merge(dat, mm,

Re: [R] counting row repetitions without loop

2008-02-06 Thread Doran, Harold
Sorry, word wrap made that incomprehensible, I think x y 4 5 6 7 6 6 7 5 5 7 6 7 4 5 6 7 7 6 5 6 dat - read.table('clipboard', header=TRUE) dat$patt - paste(dat$x,dat$y, sep='') mm - as.data.frame(with(dat, table(patt))) dat - merge(dat, mm, by='patt') mat - matrix(0, ncol=10,

[R] GLM coefficients

2008-02-06 Thread Munyandorero, Joseph
Dear all, After running a glm, I use the summary ( ) function to extract its coefficients and related statistics for further use. Unfortunately, the screen only displays a small (last) part of the results. I tried to overcome the problem by creating/saving an object coef for coefficients of the

[R] scatterplot3d + box lines

2008-02-06 Thread Pedro Mardones
Dear all; I've been trying to change the type of line used to draw the box around the 3d scatterplot (package scatterplot3d) from lty=1 to lty=2 without sucess. I would appreciate suggestions of how to do it. Thanks PM __ R-help@r-project.org mailing

Re: [R] scatterplot3d + box lines

2008-02-06 Thread Duncan Murdoch
On 2/6/2008 10:07 AM, Pedro Mardones wrote: Dear all; I've been trying to change the type of line used to draw the box around the 3d scatterplot (package scatterplot3d) from lty=1 to lty=2 without sucess. I would appreciate suggestions of how to do it. Use lty.axis=2. (This is mentioned on

[R] 3d scatterplot with error bars

2008-02-06 Thread Christopher Chizinski
Is there anyway to produce a 3D scatterplot with error bars in the x,y,z directions? I have searched around and know of scatterplot3d but did not see any way to put error bars on the points. Any ideas? __ R-help@r-project.org mailing list

Re: [R] help with oop in R - class structure and syntex

2008-02-06 Thread Gabor Grothendieck
On Feb 6, 2008 9:45 AM, tom soyer [EMAIL PROTECTED] wrote: Thanks Gabor for illustrating the basics oop in R using S3. Maybe I didn't have the right documents, but you example taught me more about oop in R than everything else I read combined! Thanks for the tip on R.oo, I plan to check it out

Re: [R] Inconsistent lattice scales$x$at, label behaviour for POSIXct

2008-02-06 Thread Alex Brown
Here's a related problem that works for numeric but not for POSIXct I am seeing it where a panel has no at labels, but others do. This simple example only has one panel with no at labels. baseval = 0; xyplot(1:10 ~ (baseval + c(1:10)), scales=list(x=list + (at=list(c()), labels=list(c()),

[R] kinship package: drawing pedigree error

2008-02-06 Thread Iris Kolder
Hi Im using the kinship package to draw a pedigree. On my data set this works fine but when i add indivudals to the pedigree i keep getting an error i hope someone can help me! This is the code im using: Data-read.table(Tree.txt, header=T, sep=,) attach(Data) ped-pedigree(id, dadid, momid,

Re: [R] Multivariate Maximum Likelihood Estimation

2008-02-06 Thread Konrad BLOCHER
OK I got gls running but this is the error message that I got: gls_results - gls(LnWRPK ~ LnWGDP+LnWYIELD,correlation = corAR1) Error in switch(mode(x), NULL = structure(NULL, class = formula), : invalid formula Google didn't give any results unfortunately. Help! :) Thanks, KB Have you

[R] Regression with time-dependent coefficients

2008-02-06 Thread achronal
Hi, I was wondering if someone might be willing to indulge a question about R and the estimation of a linear regression with time-varying coefficients. The model I am trying to estimate is of the form: y(t) = beta(t) * x(t) + v(t) beta(t) = gamma * beta(t-1) + w(t) where gamma is a constant,

[R] Running R non-interactively

2008-02-06 Thread Gang Chen
Normally I can run an R script in batch mode with a command like this R CMD BATCH MyScript.R MyOutput However I prefer to write another script containing something like R --no-restore --save --no-readline $1 $2 so that I could run the original script simply on the prompt as MyScript.R

Re: [R] help with oop in R - class structure and syntex

2008-02-06 Thread Jeffrey J. Hallman
tom soyer [EMAIL PROTECTED] writes: (1) how do I encapsulate the generics? i.e., if a class has 100 methods, then does it mean 100 generics would be dumped in the global environment? Or, is it possible to define a local environment and restrict the generics from one class to a particular

Re: [R] help with oop in R - class structure and syntex

2008-02-06 Thread tom soyer
Thanks Gabor. I guess true oo encapsulation is not possible in R. It seems that there is an IDE for S+ in Eclipse... On 2/6/08, Gabor Grothendieck [EMAIL PROTECTED] wrote: On Feb 6, 2008 9:45 AM, tom soyer [EMAIL PROTECTED] wrote: Thanks Gabor for illustrating the basics oop in R using S3.

Re: [R] wilderSum

2008-02-06 Thread Josh Ulrich
Shubha, The calculation is: wilderSum[1] - x[1] for(i in 2:NROW(x)) { wilderSum[i] - x[i] + wilderSum[i-1] * (n-1)/n } Where 'x' is the price series and 'n' is the number of periods. You can see the calculations for all functions in TTR's source code, which is on CRAN and r-forge

Re: [R] axis help

2008-02-06 Thread Martin Elff
On Wednesday 06 February 2008 (15:14:28), [EMAIL PROTECTED] wrote: Hi, i'm having trouble with my x and y axis. The commands i'm using are below. The problem is that the y axis starts at coordinate 0,1 and the x axis starts at coordinate 0,0. As far as I know the y axis can't start

Re: [R] Discriminant function analysis

2008-02-06 Thread Tyler Smith
On 2008-02-06, Birgit Lemcke [EMAIL PROTECTED] wrote: I am using R 2.6.1 on a PowerBook G4. I would like to perform a discriminant function analysis. I found lda in MASS but as far as I understood, is it only working with explanatory variables of the class factor. I think you are

Re: [R] box.Cox.powers() warning

2008-02-06 Thread John Fox
Dear Clara, The warning is nothing to worry about. If start values aren't specified, box.cox.powers() uses optimize() to find start values for each transformation parameter (in this case, there's only one) prior to using optim() to maximize the (possibly multivariate) likelihood. In the course of

[R] Inverting a list

2008-02-06 Thread hadley wickham
Is there a built in function to invert a list? i.e. to go from list( a = c(1, 2, 3), b = c(1), d = c(2, 4) ) to list( 1 = c(a, b), 2 = c(a, d), 3 = a, 4 = 2 ) Hadley -- http://had.co.nz/ __ R-help@r-project.org mailing list

Re: [R] how to plot an user-defined function

2008-02-06 Thread John Smith
Thank all of you for your helps. They are very helpful. But I have a further question. Suppose I have the following mixed effect model thetaMixed - function(tau, i) { w - 1 / (s^2 + tau^2) mu - sum(theta * w) / sum(w) b - s[i]^2 / (s[i]^2 + tau^2) theta[i]*(1-b) + mu*b) } I

Re: [R] matrix loop

2008-02-06 Thread jim holtman
What exactly are you intending the loop to do? Why do you have the 'as.matrix' in the middle of the loop? Where was 'y' defined? Does this do what you want? outer(1:5, 1:10, +) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,]23456789 1011

[R] Res: gc() and memory efficiency

2008-02-06 Thread Milton Cezar Ribeiro
Dear Harold, I had the same problem some times ago. I noticed that after I run a set commands (cleaning all non-usefull variables) for 5 times, the system broken-down. I solved it building several scritpsNN.R and call them in a .BAT DOS file. It worked so fine, almost in my case, and the

Re: [R] Maximum number of variables allowed in a multiple linearregression model

2008-02-06 Thread Douglas Bates
On Feb 6, 2008 11:28 AM, Tony Plate [EMAIL PROTECTED] wrote: Bert Gunter wrote: I strongly suggest you collaborate with a local statistician. I can think of no circumstance where multiple regression on hundreds of thousands of variables is anything more than a fancy random number generator.

Re: [R] Res: gc() and memory efficiency

2008-02-06 Thread Henrik Bengtsson
Open suggestion/question: If you in each step of an K-step iteration load/allocate a large object, each time of a different size, followed by smaller memory allocations (due to your analysis), you might be better of if you could do the iteration such that the largest object is in the first

[R] How to split a factor (unique identifier) into several others?

2008-02-06 Thread Tribo Laboy
Hello, I have a data frame with a factor column, which uniquely identifies the observations in the data frame and it looks like this: sample1_condition1_place1 sample2_condition1_place1 sample3_condition1_place1 . . . sample3_condition3_place3 I want to turn it into three separate factor

[R] how to connect S-Plus to Matlab?

2008-02-06 Thread Michael
Hi all, I am playing around with the S-Plus ... and I am wondering how to connect it back and forth with Matlab? For example, how do I call S-Plus from within Matlab and how do I call Matlab from within S-Plus? How do I transfer data back and forth? Thanks a lot

[R] where do I find stochastic volatilities models in R or Matlab?

2008-02-06 Thread Michael
Hi all, Does anybody have the source code of stochastic volatility models in R or Matlab, for example, the Bayesian based or the simulation based SV estimations as described by Prof Eric Zivot in the following discussion? https://stat.ethz.ch/pipermail/r-sig-finance/2005q4/000501.html

Re: [R] how to connect S-Plus to Matlab?

2008-02-06 Thread Gavin Simpson
hits=-2.6 tests=BAYES_00 X-USF-Spam-Flag: NO On Wed, 2008-02-06 at 22:57 -0800, Michael wrote: Hi all, I am playing around with the S-Plus ... and I am wondering how to connect it back and forth with Matlab? For example, how do I call S-Plus from within Matlab and how do I call Matlab