Re: [R] Structural equation modeling in R(lavaan,sem)

2011-03-29 Thread jouba
i am working with the same data with the two sem functions in packages lavaan and sem the manner how description of the model are differnt for the the funcion in sem and the function sem in lavaan Thanks a lot Antra EL MOUSSELLY Date: Mon, 28 Mar 2011 12:33:46 -0700 From:

Re: [R] Structural equation modeling in R(lavaan,sem)

2011-03-29 Thread jouba
Effectively in this situation I am working with the function sem in the package sem I will try this parameter fix.c Thanks a lot Antra EL MOUSSELLY Date: Mon, 28 Mar 2011 12:42:31 -0700 From: ml-node+3412847-1368787395-225...@n4.nabble.com To: antr...@hotmail.com Subject: Re:

[R] Integration with variable bounds

2011-03-29 Thread Dmlong21
If this is posted elsewhere I cannot find it. I need to perform multiple integration where some of the variables are in the bounds of the other variables. I was trying to use R2Cuba function but cannot set the upper and lower bounds. My code so far is : int - function(y){ u2 = y[1] z2 = y[2]

[R] List extraction

2011-03-29 Thread chipmaney
I have created a list of tables with the same columns but different number of row. Example (actual list has ~200 elements): temp1- data.frame(ID=c(Herb,Shrub),stat=c(4,5),pvalue=c(.03,.04)) temp2- data.frame(ID=c(Herb,Shrub, Tree),stat=c(12,15,13),pvalue=c(.2,0.4,.3))

Re: [R] How to save heatmap as image or pdf

2011-03-29 Thread chakri_amateur
Kevin Wright-5 wrote: ?pdf I could save heat map to *.ps. Now I have another small query. In enclosed image, column and row labels are overlapping, making image unsuitable for reading. Can anyone direct me to literature/tutorial that explains how to slant labels (at an angle) or how to

[R] Scrap java scripts and styles from an html document

2011-03-29 Thread antujsrv
Hi, I am working on developing a web crawler in R and I needed some help with regard to removal of javascripts and style sheets from the html document of a web page. i tried using the xml package, hence the function xpathApply library(XML) txt =

[R] Reversing order of vector

2011-03-29 Thread Vincy Pyne
Dear R helpers Suppose I have a vector as vect1 = as.character(c(ABC, XYZ, LMN, DEF)) vect1 [1] ABC XYZ LMN DEF I want to reverse the order of this vector as vect2 = c(DEF, LMN, XYZ, ABC) Kindly guide Regards Vincy [[alternative HTML version deleted]]

Re: [R] Reversing order of vector

2011-03-29 Thread Kenn Konstabel
On Tue, Mar 29, 2011 at 10:20 AM, Vincy Pyne vincy_p...@yahoo.ca wrote: Dear R helpers Suppose I have a vector as vect1 = as.character(c(ABC, XYZ, LMN, DEF)) vect1 [1] ABC XYZ LMN DEF I want to reverse the order of this vector as vect2 = c(DEF, LMN, XYZ, ABC) rev(vect1) Kindly guide

Re: [R] List extraction

2011-03-29 Thread Dennis Murphy
do.call(rbind, L) ID stat pvalue a.1 Herb4 0.03 a.2 Shrub5 0.04 b.1 Herb 12 0.20 b.2 Shrub 15 0.40 b.3 Tree 13 0.30 HTH, Dennis On Mon, Mar 28, 2011 at 5:01 PM, chipmaney chipma...@hotmail.com wrote: I have created a list of tables with the same columns

Re: [R] Reversing order of vector

2011-03-29 Thread Joshua Wiley
Hi Vincy, You can use the function rev(). rev(vect1) [1] DEF LMN XYZ ABC Also note that a simple google search for R and reverse would have lead you to this function. HTH, Josh On Tue, Mar 29, 2011 at 12:20 AM, Vincy Pyne vincy_p...@yahoo.ca wrote: Dear R helpers Suppose I have a vector

Re: [R] Reversing order of vector

2011-03-29 Thread Philipp Pagel
On Tue, Mar 29, 2011 at 12:20:50AM -0700, Vincy Pyne wrote: vect1 = as.character(c(ABC, XYZ, LMN, DEF)) as.character is unnecessary, here. vect1 [1] ABC XYZ LMN DEF I want to reverse the order of this vector as vect2 = c(DEF, LMN, XYZ, ABC) vect2 - rev(vect1)) cu Philipp

Re: [R] Problems installing fPortfolioSolver

2011-03-29 Thread Uwe Ligges
Additionally, you can select multiple repositories at once, hence you could att R-forge and CRAN and then install.packages() will select the most appropriate packages (with highest version numbers) automatically. Uwe Ligges On 28.03.2011 21:37, David Winsemius wrote: On Mar 28, 2011, at

Re: [R] matrix inverstion

2011-03-29 Thread Petr Savicky
On Mon, Mar 28, 2011 at 04:51:00PM +0200, Rosario Garcia Gil wrote: Hello I have this matrix which I am trying to invert. I get a message about reciprocal condition number, what that does mean? XT_X [,1] [,2] [,3] [,4] [,5] [1,]30021 [2,]0201

Re: [R] error in nls, step factor reduced below minFactor

2011-03-29 Thread Keith Jewell
?nls.control warnOnly a logical specifying whether nls() should return instead of signalling an error in the case of termination before convergence. Termination before convergence happens upon completion of maxiter iterations, in the case of a singular gradient, and in the case that the

Re: [R] Make R 'Beep'

2011-03-29 Thread Alaios
Tried it ! Worked ! Thanks a lot --- On Tue, 3/8/11, Jim Lemon j...@bitwrit.com.au wrote: From: Jim Lemon j...@bitwrit.com.au Subject: Re: [R] Make R 'Beep' To: Alaios ala...@yahoo.com Cc: R-help@r-project.org Date: Tuesday, March 8, 2011, 10:14 AM On 03/08/2011 09:01 PM, Alaios wrote:

[R] Multiple area plots to share the same x-axis

2011-03-29 Thread jovian
Hello, I asked a similar question before but in an existing thread. I am not sure if it is proper etiquette to repost a similar question as a new tread, I think in this case, it might be because this way more people can see it and perhaps learn from it. (Also, part of the existing thread became

[R] producing histogram-like plot

2011-03-29 Thread Karin Lagesen
Hi! I have a dataset that looks like this: 0.0 14 0.0 3 0.9 12 0.7315 0.782 1.0 15 0.3 2 0.328 ...and so on. I.e. a value between 0 and 1, and a number I would like to plot this in a histogram-like manner. I would like to have a set of bins, each 0.1 wide,

Re: [R] producing histogram-like plot

2011-03-29 Thread Philipp Pagel
On Tue, Mar 29, 2011 at 11:05:08AM +0200, Karin Lagesen wrote: Hi! I have a dataset that looks like this: 0.0 14 0.0 3 0.9 12 ...and so on. I would like to plot this in a histogram-like manner. One way would be to re-create the original data and then simply use hist: dat -

Re: [R] question about calculating derivatives for vectors

2011-03-29 Thread Hans W Borchers
Mingwei Min mm809 at cam.ac.uk writes: Hi all, I am trying to calculating derivatives for vectors using R. I have a numerical vector, which is in time series manner and contains NAs. I want to know the changing rate throughout the whole time range. I am wondering if there is function in R

[R] Many cores support in R (Multicore Package)

2011-03-29 Thread Alaios
Dear all, I am trying to improve my code for many cores. I have started with multicore package and the function mclapply. A multicore version of the lcapply. One problem I have is that when I use this function (you can copy and paste the below) require('multicore') returni -function(i) {i}

Re: [R] comparing heatmaps

2011-03-29 Thread Alex Gutteridge
On Mon, 28 Mar 2011 19:58:40 -0700, Peter Langfelder wrote: On Mon, Mar 28, 2011 at 6:36 PM, Benton, Paul hpaul.bento...@imperial.ac.uk wrote: Benno, That helps but it only makes the color bar symmetrical. I want to be able to compare 2 different heatmaps so that 0.7 (for example) is always

[R] Pictures/ Graphics in rd-files

2011-03-29 Thread Etienne Stockhausen
Hey R-user, I’ve searched the archives about the following questions and didn’t find anything useful. The last entries are more than 2 years old. Is there now any possibility to insert a picture or a graphic in a rd-help-file? I’m looking forward for any suggestions or hints. Much thanks

Re: [R] (no subject)

2011-03-29 Thread Meytar Sorek-Hamer
Hellp I posted a message but didn't get any reply How can I send it again please? Thank you Meytar __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

[R] plotting several ROC curves on the same graph

2011-03-29 Thread meytar
Hello I am trying to make a graph of 10 different lines built each from 4 different segments and to add a darker line that will represent the average of all graphs - all in the same plot.Actually each line is a ROC plot The code I'm using for plotting one line is as follows: logit.roc.plot -

Re: [R] Installing a Package tar.gz in windows

2011-03-29 Thread Duncan Murdoch
On 11-03-28 6:41 PM, Luis Felipe Parra wrote: Duncan I have been trying to work out the solution you gave me but I haven't really got to sort it out. I tried first the option with install packages and got this: filename - file.choose() filename [1]

Re: [R] rtree() distances between tips as n by n matrix?

2011-03-29 Thread Brian Pellerin
Thanks, Simon. This is very useful. Brian On Mon, Mar 28, 2011 at 11:39 PM, Simon Blomberg s.blombe...@uq.edu.auwrote: ?cophenetic Cheers, Simon. On 29/03/11 10:27, Ben Bolker wrote: Brian Pellerinbrianpatrickpellerinat gmail.com writes: If I generate a random tree with n=10

Re: [R] Installing a Package tar.gz in windows

2011-03-29 Thread Prof Brian Ripley
On Tue, 29 Mar 2011, Duncan Murdoch wrote: On 11-03-28 6:41 PM, Luis Felipe Parra wrote: Duncan I have been trying to work out the solution you gave me but I haven't really got to sort it out. I tried first the option with install packages and got this: filename - file.choose() filename

Re: [R] Installing a Package tar.gz in windows

2011-03-29 Thread Luis Felipe Parra
Brian and Duncan. Thank you for your help. What I actually am trying to install is fPortfolioSolver, and symphony is the only package I am missing in order to be able to complete the installation. Do you know by any chance what could I do about this? Thank you Felipe Parra On Tue, Mar 29, 2011

Re: [R] Integration with variable bounds

2011-03-29 Thread Ravi Varadhan
One useful trick is to use the indicator function in your integrand to define regions where the integrand is non-zero. int - function(y){ u2 = y[1] z2 = y[2] u1 =y[3] z1 = y[4] reg.nonzero - (u2 z1 u2 = 12) (z2 z1 z2 = 12) (u1 4 u1 = z2) (u2 4 u2 = z2) ff - ifelse (reg.nonzero,

Re: [R] Urgent query about R!

2011-03-29 Thread Rachel Chu
Thank you everyone for all your help!! I have done and sent my coursework now. Hopefully it is alright! R is an interesting programming language but I am happy to leave it for now ;) Have a wonderful easter break! Best wishes, Rachel 2011/3/23 Jorge Ivan Velez jorgeivanve...@gmail.com Hi

Re: [R] Developing a web crawler

2011-03-29 Thread antujsrv
Hi Stefan, Thanks for the links you shared in the post, but i am unable to access the scripts and output. It requires a password. If you can let me know the password for the .rar file of the scripts_other 5, it would be really helpful. thanks in advance. -- View this message in context:

[R] Problems installing fPortfolioSolver

2011-03-29 Thread Luis Felipe Parra
Hello. I have been a couple of days trying to install fPortfolioSolver and have been able to do it. I am getting the following error: * installing to library 'R:/lib/R/CRAN/2.12' ERROR: dependency 'Rsymphony' is not available for package 'fPortfolioSolver' * removing

Re: [R] Installing a Package tar.gz in windows

2011-03-29 Thread Uwe Ligges
On 29.03.2011 14:21, Luis Felipe Parra wrote: Brian and Duncan. Thank you for your help. What I actually am trying to install is fPortfolioSolver, and symphony is the only package I am missing in order to be able to complete the installation. Do you know by any chance what could I do about

Re: [R] Installing a Package tar.gz in windows

2011-03-29 Thread Duncan Murdoch
On 29/03/2011 8:21 AM, Luis Felipe Parra wrote: Brian and Duncan. Thank you for your help. What I actually am trying to install is fPortfolioSolver, and symphony is the only package I am missing in order to be able to complete the installation. Do you know by any chance what could I do about

Re: [R] (no subject)

2011-03-29 Thread Uwe Ligges
On 29.03.2011 11:31, Meytar Sorek-Hamer wrote: Hellp I posted a message but didn't get any reply How can I send it again please? Thank you Meytar __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the

[R] Plotting 95% Confidence Intervals around RMA slope

2011-03-29 Thread Charlotte Brassey
Hi, I'm regressing various body dimensions upon body mass using the 'lmodel2' function, as I'm keen to obtain both OLS and RMA slope values. I also wish to create a plot of the regressions, with the 95% confidence interval of both the slope and intercept. I know how to plot 95% ci bands of the

[R] R Help Question on cor() function

2011-03-29 Thread Courtney McCracken
Hi, Does anyone know if the cor() function under the stats package adjusts for ties? Specifically, with method=spearman does R compute the ties adjusted version of Sperman's rank correlation coefficient or the uncorrected version? If not, does anyone know of a function/package that will do this?

[R] new syntax: bash-like pipe operator

2011-03-29 Thread Robert Sugar
Dear R Community, One thing that always bugged me about R is the abundance of multi-level nested statements, like: cumsum(ifelse(c(1,diff(v)),1,0)) because: a) you have to read them inside out as opposed to left-to-right b) in the console you always have to go back and type the parenthesis if

[R] How to regress data into coefficients for a gamma function

2011-03-29 Thread Walter Anderson
Hello, I need to regress data like the example below. The data points represent friction factors derived from observed trip length data. The function used to describe this data is a gamma function of the form, f(t) = a * t^b * e^(c*t) and I need to regress the data to obtain the a,b, and

[R] Fwd: comparing heatmaps

2011-03-29 Thread Benton, Paul
Thanks Tom. heatmap.2(mat, Rowv=NA, Colv=NA, col=redgreen, breaks=seq(-1,1,by=0.01), symm=TRUE, trace=none, dendrogram=none) that did the trick :) Begin forwarded message: From: Leja, Thomas Date: 29 March 2011 03:47:59 GMT+01:00 To: Benton, Paul Subject: Re: [R] comparing heatmaps Yep,

[R] 'RQuantLib for 2.12 version

2011-03-29 Thread Mauricio Romero
Dear R users, I have been trying to use RQuantLib in the 2.12.2 R version. I downloaded the .zip file from http://sourceforge.net/projects/quantlib/files/QuantLib/ http://sourceforge.net/projects/quantlib/files/QuantLib/ which didn't work, so I I downloaded the package source from

Re: [R] Scrap java scripts and styles from an html document

2011-03-29 Thread Duncan Temple Lang
On 3/28/11 11:38 PM, antujsrv wrote: Hi, I am working on developing a web crawler in R and I needed some help with regard to removal of javascripts and style sheets from the html document of a web page. i tried using the xml package, hence the function xpathApply library(XML) txt =

Re: [R] new syntax: bash-like pipe operator

2011-03-29 Thread Gabor Grothendieck
On Tue, Mar 29, 2011 at 9:56 AM, Robert Sugar robert.su...@ebi.ac.uk wrote: Dear R Community, One thing that always bugged me about R is the abundance of multi-level nested statements, like: cumsum(ifelse(c(1,diff(v)),1,0)) because: a) you have to read them inside out as opposed to

[R] Creating 3 vectors that sum to 1

2011-03-29 Thread Christopher Desjardins
I have 3 vectors: p1, p2, and p3. I would like each vector to be any possible value between 0 and 1 and p1 + p2 + p3 = 1. I want to graph these and I've thought about using scatterplot3d(). Here's what I have so far. library(scatterplot3d) p1 -

Re: [R] Creating 3 vectors that sum to 1

2011-03-29 Thread Petr Savicky
On Tue, Mar 29, 2011 at 11:20:13AM -0500, Christopher Desjardins wrote: I have 3 vectors: p1, p2, and p3. I would like each vector to be any possible value between 0 and 1 and p1 + p2 + p3 = 1. I want to graph these and I've thought about using scatterplot3d(). Here's what I have so far.

[R] Using graphics straight from R into published articles

2011-03-29 Thread blanco
Hi, I have been working with R for the past couple of years; analyzing data and producing some graphics. I was just wondering if people use graphics from R straight into articles or are they always edited in some way; fonts, headers, axis, color etc? Using photoshop or some other programs? I

Re: [R] plotting several ROC curves on the same graph

2011-03-29 Thread Brian Diggs
On 3/29/2011 2:48 AM, meytar wrote: Hello I am trying to make a graph of 10 different lines built each from 4 different segments and to add a darker line that will represent the average of all graphs - all in the same plot.Actually each line is a ROC plot The code I'm using for plotting one line

Re: [R] Help with multidimensional array

2011-03-29 Thread Bert Gunter
Folks: 1. Well, should have known better... I was wrong about what I said in my earlier post below. 2. Here's yet another way to skin the cat using matrix multiplication that is, maybe, a bit faster than using reduce. First, the three methods (left as a homework exercise to see how/why they

Re: [R] Creating 3 vectors that sum to 1

2011-03-29 Thread Richard M. Heiberger
Please look at the triplot function in the klaR package. The keyword is RSiteSearch(barycentric) Rich On Tue, Mar 29, 2011 at 12:20 PM, Christopher Desjardins cddesjard...@gmail.com wrote: I have 3 vectors: p1, p2, and p3. I would like each vector to be any possible value between 0 and 1

Re: [R] Creating 3 vectors that sum to 1

2011-03-29 Thread Greg Snow
Do a search for Dirichlet, that may give you the tools you need. Also for plotting 3 vectors that sum to 1, instead of a 3d scatter plot you should look into a triangle or trilinear plot, see ?triplot in the TeachingDemos package (the see also for that help page lists several other

Re: [R] Creating 3 vectors that sum to 1

2011-03-29 Thread Peter Ehlers
On 2011-03-29 09:20, Christopher Desjardins wrote: I have 3 vectors: p1, p2, and p3. I would like each vector to be any possible value between 0 and 1 and p1 + p2 + p3 = 1. I want to graph these and I've thought about using scatterplot3d(). Here's what I have so far. library(scatterplot3d) p1-

Re: [R] Creating 3 vectors that sum to 1

2011-03-29 Thread Bert Gunter
So you want to generate random multinomials ? ... Just generate random uniforms and divide by their sum! z - runif(3); z/sum(z) ## This can easily be modified to generate lots of random multinomial 3 vectors, e.g. z - matrix( runif(3*100), ncol=3) z/rowSums(z) ## each row is a random

Re: [R] producing histogram-like plot

2011-03-29 Thread Greg Snow
Look at the cut, tapply, and barplot functions. There is probably also a nice way to do this using ggplot2 package. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From:

Re: [R] Using graphics straight from R into published articles

2011-03-29 Thread Jonathan P Daily
I think you should google search Sweave, as well as check out the ?Sweave page. Not to mention the graphics devices that embed quite nicely into documents, like ?postscript. HTH, Jon -- Jonathan P. Daily Technician - USGS Leetown Science Center 11649 Leetown

Re: [R] plotting several ROC curves on the same graph

2011-03-29 Thread meytar
Thank you very much I'll try this Meytar From: Brian Diggs [via R] [mailto:ml-node+3415433-1829104127-202...@n4.nabble.com] Sent: Tuesday, March 29, 2011 6:46 PM To: meytar Subject: Re: plotting several ROC curves on the same graph On 3/29/2011 2:48 AM, meytar wrote: Hello I am

[R] passing arguments via ...

2011-03-29 Thread Cable, Samuel B Civ USAF AFMC AFRL/RVBXI
I would like to do something like the following: Fancyhist-function(x,...) { # first, process x into xprocess somehow, then ... if (is.null(breaks)) { # yes, I know this is wrong # define the histogram breaks somehow, then call hist: hist(xprocess,breaks=breaks,...) } else { # use

Re: [R] Using graphics straight from R into published articles

2011-03-29 Thread Philipp Pagel
On Tue, Mar 29, 2011 at 09:31:18AM -0700, blanco wrote: I was just wondering if people use graphics from R straight into articles or are they always edited in some way; fonts, headers, axis, color etc? Using photoshop or some other programs? I would like to think it is possible, better and

Re: [R] passing arguments via ...

2011-03-29 Thread Jonathan P Daily
It is not clear to me exactly what you are looking to do, but if you are trying to check whether an argument has been passed via ..., I have used this convention before. fun - function(arg, ...) { opts - list(...) if('opt' %in% names(opts)) # Do something... } Does that help?

Re: [R] passing arguments via ...

2011-03-29 Thread Henrik Bengtsson
It's easier that you think; Fancyhist - function(x, break=NULL, ...) { # first, process x into xprocess somehow, then ...  if (is.null(breaks)) { # define the histogram breaks somehow, then call hist:  }   hist(xprocess, break=breaks, ...) } /H On Tue, Mar 29, 2011 at 10:47 AM, Cable,

Re: [R] How to regress data into coefficients for a gamma function

2011-03-29 Thread Peter Ehlers
On 2011-03-29 06:57, Walter Anderson wrote: Hello, I need to regress data like the example below. The data points represent friction factors derived from observed trip length data. The function used to describe this data is a gamma function of the form, f(t) = a * t^b * e^(c*t) and I need

Re: [R] Probing a function

2011-03-29 Thread Peter Ehlers
Dennis, I see that Henrik has given you a clear explanation of how to see the code 'on the fly'. But he's probably too modest to point out that it would be even better to inspect the source code which you can obtain by downloading and unzipping the relevant .tar.gz file from CRAN. Here you will

Re: [R] xlsx problem

2011-03-29 Thread Steven McKinney
Hi Cristoph, Glad to hear it worked - replying to r-help in case others face this issue. Cheers Steven McKinney From: Martin Knapp [mkna...@aucklanduni.ac.nz] Sent: March 28, 2011 7:28 PM To: Steven McKinney Subject: Re: [R] xlsx problem Thanks that

Re: [R] passing arguments via ...

2011-03-29 Thread Bert Gunter
Passing arguments can be tricky ( take a look at plot.default !!). There may be a better approach then what you have considered. hist is (S3) generic. So make a method for an S3 class that will handle data structures like your x. Something like: class(x ) - c(zebra,class(x)) hist.zebra -

Re: [R] Creating 3 vectors that sum to 1

2011-03-29 Thread Ravi Varadhan
The following one-liner generates uniformly distributed 3-tuples that sum to 1: diff(c(0, sort(runif(2)), 1)) More, generally you can generate n-tuples that sum to unity as: diff(c(0, sort(runif(n-1)), 1)) Ravi. Ravi

Re: [R] Pictures/ Graphics in rd-files

2011-03-29 Thread baptiste auguie
Hi, The following read might be useful, http://romainfrancois.blog.free.fr/index.php?post/2010/04/03/embed-images-in-Rd-documents baptiste On 29 March 2011 22:33, Etienne Stockhausen einohr2...@web.de wrote: Hey R-user, I’ve searched the archives about the following questions and didn’t

[R] Degree symbol

2011-03-29 Thread stephen's mailinglist account
I have been using both Windows and Linux versions of R so when I have opened files created in Windows I have found some issues in Linux. One was that my windows setup allowed me to enter a degree symbol from the keyboard for labelling axes. Now I have found that the following expression seems to

Re: [R] Degree symbol

2011-03-29 Thread Duncan Murdoch
On 29/03/2011 2:40 PM, stephen's mailinglist account wrote: I have been using both Windows and Linux versions of R so when I have opened files created in Windows I have found some issues in Linux. One was that my windows setup allowed me to enter a degree symbol from the keyboard for labelling

Re: [R] Creating 3 vectors that sum to 1

2011-03-29 Thread Ravi Varadhan
Here is an exploration of two different 3-tuple generators (that sum to 1) based on Greg's triplot function: require(TeachingDemos) n - 1000 rtrg - matrix(NA, n, 3) for (i in 1:n) rtrg[i,] - diff(c(0, sort(runif(2)), 1)) rtrg2 - matrix(NA, n, 3) for (i in 1:n) { tmp - runif(3) rtrg2[i, ] -

Re: [R] Creating 3 vectors that sum to 1

2011-03-29 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Bert Gunter Sent: Tuesday, March 29, 2011 10:07 AM To: Petr Savicky; cddesjard...@gmail.com Cc: r-help@r-project.org Subject: Re: [R] Creating 3 vectors that sum to 1 So you

Re: [R] R Help Question on cor() function

2011-03-29 Thread Peter Ehlers
On 2011-03-29 07:45, Courtney McCracken wrote: Hi, Does anyone know if the cor() function under the stats package adjusts for ties? Specifically, with method=spearman does R compute the ties adjusted version of Sperman's rank correlation coefficient or the uncorrected version? If not, does

[R] Simple but elusive - expand back from counts

2011-03-29 Thread jjap
Dear R-users, This should be simple but still eludes me: Given the following tmp-as.data.frame(matrix(c(44, 10, abc, 1, 44, 10, def, 1, 44, 12, abc, 2), 3, 4, byrow=T)) I want to expand the data to the following form: V1 V2 V3 V4 1 44 10 abc 1 2 44 10 def 1 3 44 12 abc 1 4 44 12 abc 1

Re: [R] Integration with variable bounds

2011-03-29 Thread Dmlong21
Thanks for the tip but all I get is 0 for the integral. Any other suggestions? int - function(y){ u2 = y[1] z2 = y[2] u1 =y[3] z1 = y[4] reg.nonzero - (u2 z1 u2 z2) (z2 z1 z2 12) (u1 4 u1 z1) (z1 4 z1 12) ff - ifelse (reg.nonzero, u1*(z1-u1)*u2*(z2-u2)*exp(-0.027*(12-z2)), 0)

Re: [R] Degree symbol

2011-03-29 Thread stephen's mailinglist account
On 29 March 2011 19:48, Duncan Murdoch murdoch.dun...@gmail.com wrote: On 29/03/2011 2:40 PM, stephen's mailinglist account wrote: I have been using both Windows and Linux versions of R Now I have found that the following expression seems to work on both systems xlab =

[R] ggplot2: scale_y_log10() with geom_histogram

2011-03-29 Thread Markus Loecher
Dear ggplot2 users, is there an easy/elegant way to suppress zero count bars in histograms with logarithmic y axis ? One (made up) example would be qplot(exp(rnorm(1000))) + geom_histogram(colour = cornsilk, fill = darkblue) + scale_x_sqrt() + scale_y_log10() Thanks! Markus

Re: [R] Simple but elusive - expand back from counts

2011-03-29 Thread Joshua Wiley
Hi, You can use rep() to repeat the appropriate rows as in V4. For example: tmp[rep(rownames(tmp), tmp$V4), ] V1 V2 V3 V4 1 44 10 abc 1 2 44 10 def 1 3 44 12 abc 2 3.1 44 12 abc 2 if you wanted, you could then reset the row names to NULL to get 1, 2, 3, 4 rather than 3, 3.1

[R] create string with using paste.

2011-03-29 Thread Praveen Surendran
Hi, I am trying to create a string - Double quotes : using paste. a command something like paste('Double','quotes : \',sep= ) prints Double quotes : \ where backslash is also printed. Is there a way to print just ? Regards, Praveen. [[alternative HTML version deleted]]

Re: [R] Degree symbol

2011-03-29 Thread Duncan Murdoch
On 29/03/2011 3:11 PM, stephen's mailinglist account wrote: On 29 March 2011 19:48, Duncan Murdochmurdoch.dun...@gmail.com wrote: On 29/03/2011 2:40 PM, stephen's mailinglist account wrote: I have been using both Windows and Linux versions of R Now I have found that the following

Re: [R] Simple but elusive - expand back from counts

2011-03-29 Thread Petr Savicky
On Tue, Mar 29, 2011 at 11:15:33AM -0700, jjap wrote: Dear R-users, This should be simple but still eludes me: Given the following tmp-as.data.frame(matrix(c(44, 10, abc, 1, 44, 10, def, 1, 44, 12, abc, 2), 3, 4, byrow=T)) I want to expand the data to the following form: V1 V2

Re: [R] Simple but elusive - expand back from counts

2011-03-29 Thread Peter Alspach
Tena koe Try something like: tmp[rep(1:nrow(tmp), each=tmp[,4]),] # untested HTH ... Peter Alspach -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of jjap Sent: Wednesday, 30 March 2011 7:16 a.m. To: r-help@r-project.org

Re: [R] Simple but elusive - expand back from counts

2011-03-29 Thread Henrique Dallazuanna
Try this: transform(tmp[rep(seq(nrow(tmp)), as.numeric(tmp$V4)),], V4 = 1) On Tue, Mar 29, 2011 at 3:15 PM, jjap sab...@gmail.com wrote: Dear R-users, This should be simple but still eludes me: Given the following tmp-as.data.frame(matrix(c(44, 10, abc, 1, 44, 10, def, 1, 44, 12, abc, 2),

Re: [R] ggplot2: scale_y_log10() with geom_histogram

2011-03-29 Thread Joshua Wiley
Hi Markus, In some ways, this is not the most elegant solution ever, as you have to manually pick some limits, but it is fairly straightforward: qplot(exp(rnorm(1000))) + geom_histogram(colour = cornsilk, fill =darkblue) + scale_x_sqrt() + scale_y_log10() + coord_cartesian(ylim = c(10^0,

Re: [R] create string with using paste.

2011-03-29 Thread Henrique Dallazuanna
Try this: cat(Double quotes: \\n) On Tue, Mar 29, 2011 at 4:18 PM, Praveen Surendran praveen.surend...@ucd.ie wrote: Hi, I am trying to create a string -      Double quotes : using paste. a command something like paste('Double','quotes : \',sep= ) prints Double quotes : \ where backslash

Re: [R] Degree symbol

2011-03-29 Thread stephen's mailinglist account
Thank you I will experiment with source (looks to be source(file, encoding=getOption(latin1 or UTF-8)). No, getOption(encoding) is the literal default, not some sort of general form.  You want encoding=latin1 (assuming the whole file uses that encoding). Duncan Murdoch Sorry, thank

Re: [R] Creating 3 vectors that sum to 1

2011-03-29 Thread Greg Snow
Or we could expand a bit more: require(TeachingDemos) require(gtools) n - 1000 rtrg - matrix(NA, n, 3) for (i in 1:n) rtrg[i,] - diff(c(0, sort(runif(2)), 1)) rtrg2 - matrix(NA, n, 3) for (i in 1:n) { tmp - runif(3) rtrg2[i, ] - tmp/sum(tmp) } rtrg3 - matrix( rexp(n*3), ncol=3 ) rtrg3 -

Re: [R] Creating 3 vectors that sum to 1

2011-03-29 Thread Christopher Desjardins
Thanks several of these do exactly what I want. Chris On Tue, Mar 29, 2011 at 2:42 PM, Greg Snow greg.s...@imail.org wrote: Or we could expand a bit more: require(TeachingDemos) require(gtools) n - 1000 rtrg - matrix(NA, n, 3) for (i in 1:n) rtrg[i,] - diff(c(0, sort(runif(2)), 1))

Re: [R] Simple but elusive - expand back from counts

2011-03-29 Thread jjap
Many thanks to all, the first 3 solutions worked nicely but I did not get around to tweaking properly the others. It's really nice to get thing going in a one liner or about... Again greatly appreciated. Cheers! -- View this message in context:

Re: [R] Structural equation modeling in R(lavaan,sem)

2011-03-29 Thread jouba
Dear all, There is some where documentation to understand all indices in the output of the function sem(package lavaan ) ?? for example Chi-square test baseline model, Full model versus baseline model, Loglikelihood and Information Criteria, Root Mean Square Error of Approximation, Standardized

[R] Select subset of data

2011-03-29 Thread Lisa
Dear All, I have a dataset that looks like this: group subject result v4 v5 1 1 1 0 1 0 2 1 2 1 0 0 3 1 3 0 0 0 4 1 4 1 0 0 5 2 1 0 1 1 6 2 2 0 0 1 7 2 3 0 1 1

Re: [R] Select subset of data

2011-03-29 Thread Phil Spector
Lisa - Suppose your data frame is called somedat. Then do.call(rbind,spl[sapply(spl,function(z)z$result[1] == 0 z$result[2] == 0 sum(z$result) == 1)]) should give you what you want. - Phil Spector

Re: [R] Structural equation modeling in R(lavaan,sem)

2011-03-29 Thread Jeremy Miles
sem (the package) documentation is not intended to teach you how to do SEM (the technique) (there's very little R documentation that is intended to teach you how to do a particular statistical technique). There are several good books out there, but here's a free access journal article, which will

Re: [R] Select subset of data

2011-03-29 Thread David Winsemius
On Mar 29, 2011, at 3:40 PM, Lisa wrote: Dear All, I have a dataset that looks like this: group subject result v4 v5 1 1 1 0 1 0 2 1 2 1 0 0 3 1 3 0 0 0 4 1 4 1 0 0 5 2 1 0 1 1 6 2 2 0

[R] lme:correlationstructure AR1 and random factor

2011-03-29 Thread yvonne fabian
Dear helpers, I tried these models to run in the package nlme, but allways got the same error message... I have a correlation in 5 sessions within a field (n=12) with ten traps in one field. res2a - lme(response~x+y+z+treatment),correlation = corARMA(form = ~ session|trapfield, p = 1, q = 0),

[R] Intercept and slope of GLS model

2011-03-29 Thread John Haart
Dear list - A simple question, i hope! With this truncated output from a GLS model the intercept is 0.004634487 but where is the slope? Coefficients: Value Std.Error t-valuep-value (Intercept) 0.004634487

Re: [R] Structural equation modeling in R(lavaan,sem)

2011-03-29 Thread jouba
Ok thanka lot you for your response Antra EL MOUSSELLY Date: Tue, 29 Mar 2011 13:31:32 -0700 From: ml-node+3416220-556418632-225...@n4.nabble.com To: antr...@hotmail.com Subject: Re: Structural equation modeling in R(lavaan,sem) sem (the package) documentation is not intended to teach

Re: [R] Structural equation modeling in R(lavaan,sem)

2011-03-29 Thread jouba
Dear all I have an error mesage « error message : the MLM estimator can not be used when data are incomplete » When i use the function sem(package lavaan) and when i fill the paramters estimator and missing estimator=MLM, missing=ml i understand by this that i am not allowed to

[R] Hnadling missing data In R

2011-03-29 Thread jouba
Dear all, I have data that contain more than 30 variables and 600 observations, it’s a longitudinal data,data contains a lot of non normal data (despite trying to do some transformation i hav still nonnormal variables ) i have a lot of missing data, i want to impute these missing data ,

[R] Dirichlet surface

2011-03-29 Thread Kehl Dániel
Dear list members, I want to draw surfaces of Dirichlet distributions with different parameter settings. My code is the following: #begin code a1 - a2 - a3 - 2 #a2 - .5 #a3 - .5 x1 - x2 - seq(0.01, .99, by=.01) f - function(x1, x2){ term1 -

Re: [R] Select subset of data

2011-03-29 Thread Lisa
Thank you for your kind help. Your R code works very well. -- View this message in context: http://r.789695.n4.nabble.com/Select-subset-of-data-tp3416012p3416307.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org

Re: [R] Intercept and slope of GLS model

2011-03-29 Thread Ben Bolker
John Haart another83 at me.com writes: With this truncated output from a GLS model the intercept is 0.004634487 but where is the slope? Coefficients: Value Std.Error t-valuep-value (Intercept) 0.004634487

[R] normal distribution and floating point traps (?): unexpected behavior

2011-03-29 Thread Patrizio Frederic
dear all, here's a couple of questions that puzzled me in these last hours: # issue 1 qnorm(1-10e-100)!=qnorm(10e-100) qnorm(1-1e-10) == -qnorm(1e-10) # turns on to be FALSE. Ok I'm not a computer scientist but, # but I had a look at the R inferno so I write: all.equal(qnorm(1-1e-10) ,

  1   2   >