Dear R Help group I need to run a command line script from within R session. I am not clear how i can acheive this. I tried shell and system function, but i am missing something critical.can someone provide help? My intention is to create a pdf file of a plot in R and then attach existing files from my system as attachment into the newly created pdf file. Any help would be greatly appreciated.. Here is the command line script i want to execute from within R. pdftools -S "attachfiles=C:\test1.pdf" -i C:\test2.pdf -o C:\test4.pdf Regards Vijayan Padmanabhan [[alternative HTML version deleted]]
One way that u might have thought of is to create plot in PDF in R and the use pdftools. Additionally one can also think of running R script using R CMD and then using pdftools in a .sh script file if u r in linux. I am not aware of pdftools capability in R. On 2 April 2011 23:01, Vijayan Padmanabhan <padmanabhan.vijayan@gmail.com>wrote:> Dear R Help group > I need to run a command line script from within R session. I am not clear > how i can acheive this. I tried shell and system function, but i am missing > something critical.can someone provide help? > My intention is to create a pdf file of a plot in R and then attach > existing files from my system as attachment into the newly created pdf > file. > Any help would be greatly appreciated.. Here is the command line script i > want to execute from within R. > > > pdftools -S "attachfiles=C:\test1.pdf" -i C:\test2.pdf -o C:\test4.pdf > > Regards > Vijayan Padmanabhan > > [[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. >-- Amar Kumar Nandan Karnataka, India, 560100 http://aknandan.co.nr [[alternative HTML version deleted]]
Hey Everyone! I´m a quite new R user .. I found a problem that I'd like to share with you and help me find a solution. I have a large txt. file which I opened with read.table command, and what I understood from many R manuals is that I have a kind of matrix readed with read.table, I've used order() to sort my data and now my problem is: I have a variable that has many repeated values and I would like to operate with the row indexes of "these repeated values": for example, suppose I have: var1 var2 … varN 122 nnn1 … 1 213 nnn2 … 2 422 nnn4 … 2 432 … … 3 441 … … 4 500 … … 4 550 … … 4 So I want to obtain a new column where all elements of var1 are added at the places where varN are repetead ... so for varN=2 the new column correspond to this element will be 213+422, for varN=4 will be 441+500+550, where there is no such repeated values obviously there´s nothing to do and varN is the unique value. I made a function to do this but is not so good, (I hava a database with around 1 million rows and 5 columns) actually, this function works for not so large data: suma.rep=function(X,Y){ resp=numeric(0) Z=unique(Y) for (i in (1:length(Z))) resp=c(resp,sum(X[which(Y==Z[i])])) return(resp)} When I run this function with my large data, R appears calculating and I think it would take so long to make my new required column.(maybe 4 days) Question1: I "feel" that maybe there's a command that could help me to do this "simple" operation more elegant, I googled it but I couldnt find... Is there any such a command? Question2: Is a good idea to handle large data bases files with R, as in my example? Thank you so much for your help. Christian Paúl [[alternative HTML version deleted]]
Thanks a lot Jim, Dennis. Jim, actually where "dots" were I meant "etcetera" or "similar data". ;) My output is close to that one Dennis proposed with function aggregate, but i would like to keep the column var2 and the rest of columns with the unique value corresponding to var1 greatest value, So suppose the example is: var1 var2 … varN 122 nnn1 … 1 213 nnn2 … 2 422 nnn4 … 2 432 nnn5 … 3 441 nnn6 … 4 550 nnn7 … 4 500 nnn8 … 4 The output were: var1 var2 … varN 122 nnn1 … 1 635 nnn4 … 2 432 nnn5 … 3 550 nnn7 … 4 Maybe that´s the reason for what I want to keep the "indexes" where the conditions are satisfied ( unique varN, sum of var1 were varN are the same, and value of var1 that is the greatest relative to the others same-VarN values). Thanks for your help! Chriss Paúl. [[alternative HTML version deleted]]
Accelerated Failure Time Model to Proportional Hazard Form Greetings R users: I have been working on a problem for a while and can't seem to get any result. I am trying to convert accelerated failure time estimates to proportional form. I keep getting an error that I can't understand and don't know if it can be debugged or not. My code is as follows: data<-read.csv("repdata.csv") da<-na.omit(data) attach(da) library(survival) library(rms) weib1<-psm(Surv(time,ratified)~island+pop+gdppc+fh+nngo+industryemplimp+icrgfromper+ngoicrgfromper+industryemplimpicrgfromper, data=da, dist="weibull",init=NULL, scale=0, control=survreg.control(maxiter=1000)) print(weib1) f.ph<-pphsm(weib1) However, after running the last line of code, I get the following: Warning message: In pphsm(weib1) : at present, pphsm does not return the correct covariance matrix Any suggestions will be greatly appreciated!! My data is attached. Thanks in Advance NSPENCER