Re: [R] Running other programs from R
Have a look at the system command: ?system HTH, Jan On 03/16/2013 10:09 PM, Sedat Sen wrote: Dear list, I want to run a statistical program (using its .exe file) from R by writing a script. I know there are some packages that call WinBUGS, Mplus etc. form R. I just want to call the .exe extension of this program and run several times writing a code in R. Thus, I want to have the output inside R. I just don't know where to start. Does anyone have any idea about that? Is there a universal package to call application files of other stat programs using their application files. p.s. The program I am talking about is an IRT program called Multilog. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] reading a specific part of a text file into R
I was wondering if it is possible read a specific part of a text file in R without importing whole file. For example, I want to read a number where is located on the line 30 and columns between 2 and 4. Say the number is 456. can I see it without opening the file. I want to learn how to do this because I am doing many analyses which result in the same style output. I just need to read only one line in these outputs. Is there any specific function for this purpose? I googled it but did not find anything helpful. -- *Sedat * [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Running other programs from R
Use the system() command. e.g. system(Multilog) On Sat, Mar 16, 2013 at 5:09 PM, Sedat Sen sedatse...@gmail.com wrote: Dear list, I want to run a statistical program (using its .exe file) from R by writing a script. I know there are some packages that call WinBUGS, Mplus etc. form R. I just want to call the .exe extension of this program and run several times writing a code in R. Thus, I want to have the output inside R. I just don't know where to start. Does anyone have any idea about that? Is there a universal package to call application files of other stat programs using their application files. p.s. The program I am talking about is an IRT program called Multilog. -- *Sedat * [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Thomas E Adams, III 718 McBurney Drive Lebanon, OH 45036 1 (513) 739-9512 (cell) [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] reading a specific part of a text file into R
On 17-03-2013, at 06:23, Sedat Sen sedatse...@gmail.com wrote: I was wondering if it is possible read a specific part of a text file in R without importing whole file. For example, I want to read a number where is located on the line 30 and columns between 2 and 4. Say the number is 456. can I see it without opening the file. I want to learn how to do this because I am doing many analyses which result in the same style output. I just need to read only one line in these outputs. Is there any specific function for this purpose? I googled it but did not find anything helpful. Googling for what? Googling on R read lines gives a lot. Look at ?readLines Berend __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Comparing Cox model with Competing Risk model
Thanks.:) On Sat, Mar 16, 2013 at 12:51 PM, Heinz Tuechler tuech...@gmx.at wrote: Dear Terry, as soon as the vignette is ready, I would be very happy, to know about it. Will you send a note to r-help, or will it be announced in some other way? best regards, Heinz On 08.03.2013 15:12, Terry Therneau wrote: -- begin included message -- I have a competing risk data where a patient may die from either AIDS or Cancer. I want to compare the cox model for each of the event of interest with a competing risk model. In the competing risk model the cumulative incidence function is used directly. -end inclusion --- If you do want to persue the Fine-Gray model I would suggest using software that already exists. Find the Task Views tab on CRAN, and follow it to survival and then look at the competing risks section. There is a lot to offer. I would trust it more than rolling your own function. As an aside, modeling the subdistribution function is ONE way of dealing with competing risks, but not everyone thinks that it is the best way to proceed. The model corresponds to a biology that I find unlikely, though it makes for nice math. Since the alternative is discussed in a vignette that I haven't-yet-quite-written we won't persue that any further, however. :-) Terry Therneau __** R-help@r-project.org mailing list https://stat.ethz.ch/mailman/**listinfo/r-helphttps://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/**posting-guide.htmlhttp://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Running other programs from R
On Mar 16, 2013, at 2:09 PM, Sedat Sen wrote: Dear list, I want to run a statistical program (using its .exe file) from R by writing a script. I know there are some packages that call WinBUGS, Mplus etc. form R. I just want to call the .exe extension of this program and run several times writing a code in R. Thus, I want to have the output inside R. I just don't know where to start. Does anyone have any idea about that? Is there a universal package to call application files of other stat programs using their application files. p.s. The program I am talking about is an IRT program called Multilog. Even though you have been advised to use system() I don't think that will necessarily return your values inside R. You will need to supply arguments to that external function and direct it to write to a file from which you can extract its output using text processing in R. You will probably need to examine the (open source) methods used by packages that call those external programs if you demand the same level of integration as provided for example in the R2WinBUGS package. [[alternative HTML version deleted]] Please read the Posting Guide. -- David Winsemius Alameda, CA, USA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] zero line
Hi all, I´m plotting cf (with two axis) and addind a shaded color up and down on the 0 line x axis (tfr1 is the time). The thing is that when I plot this graph adds a line up on the first plot. I hope you can understand what I mean. How should I erase this sencond line, it is suposed they have the same data? Why zero line doesn´t complete the shaded area? plot(cf[,1],type=l,col=black, xlab=Time, ylab=Correlation, axes=F) grid() cord.x - c(0,1:length(cf[,1]), length(cf[,1])) cord.y - c(0,cf[,1],0) polygon(cord.x,cord.y,col='skyblue') par(new=T) variable-matrix(0,length(cf[,1]),1) plot(tfr1[(T+Tcor):(nrow(tfr1)),1],variable,type=l,ylab=,col=black,xlab=) mtext(Correlation,side=4,line=2,col=4) title(Dinamic Correlation,font=4) [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Copula package - normalCopula() param order
Hey all, I'm trying to construct a 7-dimensional normal copula using the copula package. I'd like to supply as parameter a randomly generated correlation matrix (that I'll convert to a vector so I can feed it to the normalCopula function). What order do the pairwise correlations inside that vector have to be in? In other words: What does the normalCopula function expect? Thanks! __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] How make a boxplot with Y axis in percentage
I have to make a boxplot with Years 2011 and 2012 on the x axis, and percentage of full time students (=1) and part time students (=2) on the y axis. I would really appreciate if someone can help me to build a proper code. Thanks Larissa Data as follow: Year Q1 2011 1 2011 1 2011 1 2011 1 2011 1 2011 1 2011 1 2011 1 2011 1 2011 2 2011 1 2011 1 2011 1 2011 1 2011 1 2011 1 2011 2 2011 1 2011 1 2011 1 2011 1 2011 1 2011 2 2011 1 2012 1 2012 1 2012 1 2012 1 2012 1 2012 1 2012 1 2012 1 2012 1 2012 2 2012 1 2012 1 2012 1 2012 1 2012 1 2012 2 2012 1 2012 1 2012 1 2012 1 2012 1 2012 2 2012 1 2012 1 2012 1 2012 1 2012 1 2012 1 2012 1 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Q-Q plot for chi-quadrat w/o knowing the contingency table
Hello, I have chi2-values from 2x2 contingency tables, each degree of freedom =1. But I dont know the values of the contingency table. All I have in addtion: The allelic odds ratio. Now I would like to do a Q-Q-plot. Is that possible? If yes, please let me know. If no, please let me know as well. Thanks Wim [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] help with simple function
hello all I am writing a quite simple script to study dental wear patterns in humans and I wrote this function sqrt(var(Y1)+var(Y2))^2-4(var(Y1)*(var(Y2)-cov(Y1,Y2)^2)) but appear this error message Error: attempt to apply non-function alternatively I wrote this sqrt(var(Y1)+var(Y2)^2)-4[(var(Y1)*(var(Y2)-cov(Y1,Y2)^2))] but this error message appear [1] NA Warning message: NAs introduced by coercion some suggestion to solve this?? thank you so much for your help Miguel [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] help with simple function
On 17-03-2013, at 16:47, Miguel Eduardo Delgado Burbano mdelgadoburb...@gmail.com wrote: hello all I am writing a quite simple script to study dental wear patterns in humans and I wrote this function sqrt(var(Y1)+var(Y2))^2-4(var(Y1)*(var(Y2)-cov(Y1,Y2)^2)) but appear this error message Error: attempt to apply non-function Write 4*( instead of 4( assuming you want to multiply. alternatively I wrote this sqrt(var(Y1)+var(Y2)^2)-4[(var(Y1)*(var(Y2)-cov(Y1,Y2)^2))] but this error message appear [1] NA Warning message: NAs introduced by coercion [ is an indexing operator. You are trying to index the number 4. Which is impossible. Berend some suggestion to solve this?? thank you so much for your help Miguel [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] help with simple function
Hi, Y1- 1:4 Y2- 5:8 sqrt(var(Y1)+var(Y2)^2)-4*((var(Y1)*(var(Y2)-cov(Y1,Y2)^2))) #[1] 9.515593 A.K. - Original Message - From: Miguel Eduardo Delgado Burbano mdelgadoburb...@gmail.com To: r-help@r-project.org Cc: Sent: Sunday, March 17, 2013 11:47 AM Subject: [R] help with simple function hello all I am writing a quite simple script to study dental wear patterns in humans and I wrote this function sqrt(var(Y1)+var(Y2))^2-4(var(Y1)*(var(Y2)-cov(Y1,Y2)^2)) but appear this error message Error: attempt to apply non-function alternatively I wrote this sqrt(var(Y1)+var(Y2)^2)-4[(var(Y1)*(var(Y2)-cov(Y1,Y2)^2))] but this error message appear [1] NA Warning message: NAs introduced by coercion some suggestion to solve this?? thank you so much for your help Miguel [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] help with simple function
Hello, You are missing a '*' in your first try. (As for the second, in R parenthesis are round, not []) sqrt(var(Y1) + var(Y2))^2 - 4*(var(Y1)*(var(Y2) - cov(Y1, Y2)^2)) This written as a function becomes fun - function(Y1, Y2) sqrt(var(Y1) + var(Y2))^2 - 4*(var(Y1)*(var(Y2) - cov(Y1, Y2)^2)) x1 - rnorm(10) x2 - rnorm(10) fun(x1, x2) Hope this helps, Rui Barradas Em 17-03-2013 15:47, Miguel Eduardo Delgado Burbano escreveu: hello all I am writing a quite simple script to study dental wear patterns in humans and I wrote this function sqrt(var(Y1)+var(Y2))^2-4(var(Y1)*(var(Y2)-cov(Y1,Y2)^2)) but appear this error message Error: attempt to apply non-function alternatively I wrote this sqrt(var(Y1)+var(Y2)^2)-4[(var(Y1)*(var(Y2)-cov(Y1,Y2)^2))] but this error message appear [1] NA Warning message: NAs introduced by coercion some suggestion to solve this?? thank you so much for your help Miguel [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How make a boxplot with Y axis in percentage
Hello, I don't see how a boxplot with your dataset can make sense. Maybe a barplot like the one below. dat - structure(list(Year = c(2011, 2011, 2011, 2011, 2011, 2011, 2011, 2011, 2011, 2011, 2011, 2011, 2011, 2011, 2011, 2011, 2011, 2011, 2011, 2011, 2011, 2011, 2011, 2011, 2012, 2012, 2012, 2012, 2012, 2012, 2012, 2012, 2012, 2012, 2012, 2012, 2012, 2012, 2012, 2012, 2012, 2012, 2012, 2012, 2012, 2012, 2012, 2012, 2012, 2012, 2012, 2012, 2012), Q1 = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1)), .Names = c(Year, Q1), row.names = c(NA, -53L), class = data.frame) dat2 - xtabs(~ Q1 + Year, data = dat) dat3 - t(t(dat2)/colSums(dat2)) barplot(dat3, beside = TRUE, legend.text = TRUE) Also, the best way to give a data example is to use dput(): dput(dat) # paste the output of this in a post. That's the structure() above. Hope this helps, Rui Barradas Em 17-03-2013 12:50, Larissa Schneider Guilhon escreveu: I have to make a boxplot with Years 2011 and 2012 on the x axis, and percentage of full time students (=1) and part time students (=2) on the y axis. I would really appreciate if someone can help me to build a proper code. Thanks Larissa Data as follow: Year Q1 2011 1 2011 1 2011 1 2011 1 2011 1 2011 1 2011 1 2011 1 2011 1 2011 2 2011 1 2011 1 2011 1 2011 1 2011 1 2011 1 2011 2 2011 1 2011 1 2011 1 2011 1 2011 1 2011 2 2011 1 2012 1 2012 1 2012 1 2012 1 2012 1 2012 1 2012 1 2012 1 2012 1 2012 2 2012 1 2012 1 2012 1 2012 1 2012 1 2012 2 2012 1 2012 1 2012 1 2012 1 2012 1 2012 2 2012 1 2012 1 2012 1 2012 1 2012 1 2012 1 2012 1 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] !0 + !0 == !0 - !0
Hi all, The subject line is TRUE. Today I accidentally typed rnorm(!0). My old eyes took a minute to focus clearly enough to see what I really typed and why I got '!0' random numbers instead of '10' random normal numbers. If the subject line is disturbing, be assured that this is TRUE: !0^2 == !0 * !0 # ;-) Anyway, I hope the hands who have been around long enough to know FAQ 7.31 by heart and know why precedence of operators matters have a laugh. Best, Chuck __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] !0 + !0 == !0 - !0
Chuck, What an absolutely wonderful R Infernoism. Pat On 18/03/2013 02:17, Charles Berry wrote: Hi all, The subject line is TRUE. Today I accidentally typed rnorm(!0). My old eyes took a minute to focus clearly enough to see what I really typed and why I got '!0' random numbers instead of '10' random normal numbers. If the subject line is disturbing, be assured that this is TRUE: !0^2 == !0 * !0 # ;-) Anyway, I hope the hands who have been around long enough to know FAQ 7.31 by heart and know why precedence of operators matters have a laugh. Best, Chuck __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Patrick Burns pbu...@pburns.seanet.com twitter: @burnsstat @portfolioprobe http://www.portfolioprobe.com/blog http://www.burns-stat.com (home of: 'Impatient R' 'The R Inferno' 'Tao Te Programming') __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] !0 + !0 == !0 - !0
But this has nothing to do with 7.31 and everything to do with operator precedence and automatic casting from integers to logical and vice-versa. I also think it fair to say that all (??) languages have these sorts of malapropisms due to operator precedence. -- Bert On Sun, Mar 17, 2013 at 7:17 PM, Charles Berry ccbe...@ucsd.edu wrote: Hi all, The subject line is TRUE. Today I accidentally typed rnorm(!0). My old eyes took a minute to focus clearly enough to see what I really typed and why I got '!0' random numbers instead of '10' random normal numbers. If the subject line is disturbing, be assured that this is TRUE: !0^2 == !0 * !0 # ;-) Anyway, I hope the hands who have been around long enough to know FAQ 7.31 by heart and know why precedence of operators matters have a laugh. Best, Chuck __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Bert Gunter Genentech Nonclinical Biostatistics Internal Contact Info: Phone: 467-7374 Website: http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Specifying point symbol fill colour in lattice xyplot keys
Dear Duncan, Many thanks for that advice. It looked like it should work, but it only affected the points on the graph, and not the ones on the key. Looking at the lattice source, the draw.key function doesn't seem to consult many settings. I'm now pretty confident that the fill parameter is not having an affect due to a small bug in the lattice draw.key function. Within the draw.key function there's a function called process.key, whose return value provides a template that determines which parameters from the 'points' key item will be copied to the output key. It takes a bunch of arguments, including 'fill', and includes all arguments -- except for 'fill' -- in its return value. If I add 'fill=fill' to its return value list, then my example code works as expected. Best wishes, Wayne Rochester CSIRO, Brisbane, Australia Original Message Subject: Re: Specifying point symbol fill colour in lattice xyplot keys From: Wayne Rochester wayne.roches...@csiro.au To: Wayne Rochester wayne.roches...@csiro.au Date: 18/03/13 11:54 Hi Wayne Try this library(lattice) xyplot(1:10 ~ 1:10, par.settings = list(plot.symbol = list(col = blue, fill = red, cex = 1, pch = 21)), type = p, key = list(points = list(col = blue, fill = red, cex = 3, pch = 21)) ) I sometimes have trouble with passing colours etc to panels and keys in lattice but this seems to work. If you have groups change plot.symbol to superpose.symbol Duncan Duncan Mackay Department of Agronomy and Soil Science University of New England Armidale NSW 2351 Email: home: mackay at northnet.com.au Original Message Subject: Specifying point symbol fill colour in lattice xyplot keys From: Wayne Rochester wayne.roches...@csiro.au To: R-help r-help@r-project.org Date: 12/03/13 11:11 Dear all, When defining explicit keys with xyplot, I have previously used the fill parameter to set the background colour of point symbols. That's no longer working for me, and I am wondering whether it's a bug or whether I've misinterpreted the documentation and have been relying on a feature wasn't intended. If the latter, can anyone suggest the correct way to do it? Here's an example of what I am trying to do: library(lattice) print(xyplot(y ~ x, data=data.frame(x=1:10, y=1:10), key=list(points=list(pch=21, col=blue, cex=3, fill=red Only the key is of interest here. It doesn't match the data and isn't meant to. On R 2.15.2 and lattice 0.20-10 the circle in the key has a blue outline and a red fill colour. On R 2.15.3 and lattice 0.20-13 the fill is transparent (or white). The source code for draw.key looks like it is sill trying to support the fill option. I have been able to confirm the old behaviour with the old R and lattice versions on Ubuntu 11.10 and openSUSE 12.2. I have confirmed the new behaviour with the new versions on Ubuntu 11.10 and Windows 7. Many thanks, Wayne Rochester CSIRO, Brisbane, Australia -- Dr Wayne Rochester Research Scientist CSIRO Marine and Atmospheric Research Level 1 Block B Ecosciences Precinct GPO Box 2583 Brisbane Qld 4001 Phone: +61 (0)7 3833 5943 Fax: +61 (0)7 3833 5501 E-mail: wayne.roches...@csiro.au WWW: http://www.csiro.au/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.