Re: [R] Read big data (3G ) methods ?
Do you really have the need loading all the data into memory? Mostly for large data set, people would just read a chunk of it for developing analysis pipeline, and when that's done, the ready script would just iterate through the entire data set. For example, the read.table function has 'nrow' and 'skip' parameters to control the reading of data chunks. read.table(file, nrows = -1, skip = 0, ...) And another tip here is, you can split the large file into smaller ones. On Fri, Apr 26, 2013 at 8:09 AM, Kevin Hao rfans4ch...@gmail.com wrote: Hi all scientists, Recently, I am dealing with big data ( 3G txt or csv format ) in my desktop (windows 7 - 64 bit version), but I can not read them faster, thought I search from internet. [define colClasses for read.table, cobycol and limma packages I have use them, but it is not so fast]. Could you share your methods to read big data to R faster? Though this is an odd question, but we need it really. Any suggest appreciates. Thank you very much. kevin [[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. [[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] speed of a vector operation question
I think the sum way is the best. On Fri, Apr 26, 2013 at 9:12 AM, Mikhail Umorin mike...@gmail.com wrote: Hello, I am dealing with numeric vectors 10^5 to 10^6 elements long. The values are sorted (with duplicates) in the vector (v). I am obtaining the length of vectors such as (v c) or (v c1 v c2), where c, c1, c2 are some scalar variables. What is the most efficient way to do this? I am using sum(v c) since TRUE's are 1's and FALSE's are 0's. This seems to me more efficient than length(which(v c)), but, please, correct me if I'm wrong. So, is there anything faster than what I already use? I'm running R 2.14.2 on Linux kernel 3.4.34. I appreciate your time, Mikhail [[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. [[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] Input Chinese characters not correctly echoed in ESS
I had this weird encoding issue for my Emacs and R environment. Display of Chinese characters are all good with my .Rprofile setting Sys.setlocale(LC_ALL,zh_CN.utf-8); except the echo of input ones. linkTexts[5] font 使ç¨å¸®å© functionNotExist() é误: 没æfunctionNotExistè¿ä¸ªå½æ° fire - ä½ å¥½ fire [1] As we can see, Chinese characters contained in the vector linkTexts, Chinese error messages, and input Chinese characters all can be perfectly shown, yet the echo of input characters were only shown as blank placeholders. sessionInfo() is here, which is as expected given the Sys.setlocale(LC_ALL,zh_CN.utf-8); setting: sessionInfo() R version 2.15.2 (2012-10-26) Platform: i386-apple-darwin9.8.0/i386 (32-bit) locale: [1] zh_CN.utf-8/zh_CN.utf-8/zh_CN.utf-8/C/zh_CN.utf-8/C attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] XML_3.96-1.1 loaded via a namespace (and not attached): [1] compiler_2.15.2 tools_2.15.2 And I have no locale settings in the .Emacs file. To me, this seems to be an Emacs encoding issue, but I just don't know how to correct it. Any idea or suggestion? Thanks. [[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] Transferring R to another computer, R_HOME_DIR
Well, to my understanding, you planned to rsync the original compiled folder from one machine to somewhere on another machine, and work with it. Then how about create a file link on the second machine for /usr/lib64/R? Or maybe I misunderstand your purpose? On Thu, Apr 25, 2013 at 5:57 PM, Saptarshi Guha saptarshi.g...@gmail.comwrote: Hello, I was looking at the R (installed on RHEL6) shell script and saw R_HOME_DIR=/usr/lib64/R. Nowhere (and I could have got it wrong) does it read in the environment value R_HOME_DIR. I have the need to rsync the entire folder below /usr/lib64/R to another computer into another directory location. Without changing the R shell script, how can i force it read in R_HOME_DIR? Or maybe i misunderstood the bash source? (Note, i cannot recompile on target machine) Cheers Saptarshi 1. I also realize Rscript will not work (i think path is hard coded in the source) Beginning of /usr/lib64/R/bin/R R_HOME_DIR=/usr/lib64/R if test ${R_HOME_DIR} = /usr/lib64/R; then case linux-gnu in linux*) run_arch=`uname -m` case $run_arch in x86_64|mips64|ppc64|powerpc64|sparc64|s390x) libnn=lib64 libnn_fallback=lib ;; *) libnn=lib libnn_fallback=lib64 ;; esac if [ -x /usr/${libnn}/R/bin/exec/R ]; then R_HOME_DIR=/usr/lib64/R elif [ -x /usr/${libnn_fallback}/R/bin/exec/R ]; then R_HOME_DIR=/usr/lib64/R ## else -- leave alone (might be a sub-arch) fi ;; esac fi [[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. [[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] Assignments inside lapply
unlist(lapply(1:nrow(ij),function(rowId) { return (Powermap[i,j]-Pr(c(ij$i[rowId],ij$j[rowId]),c(PRX,PRY),f)) }))lapply actually catches each return value of the excuted function. here your function actually returns nothing if the assignment succeeds. If your purpose for the call to Pr is just its result, then you don't need place an assignment here. The lapply can automatically catch the result series. At 2011-04-27 17:36:55£¬Alaios ala...@yahoo.com wrote: Dear all I would like to ask you if an assignment can be done inside a lapply statement. For example I would like to covert a double nested for loop for (i in c(1:dimx)){ for (j in c(1:dimy)){ Powermap[i,j] - Pr(c(i,j),c(PRX,PRY),f) } } to something like that: ij-expand.grid(i=seq(1:dimx),j=(1:dimy)) unlist(lapply(1:nrow(ij),function(rowId) { return (Powermap[i,j]-Pr(c(ij$i[rowId],ij$j[rowId]),c(PRX,PRY),f)) })) as you can see lapply does not return nothing as the assignment is done inside the function. Would that work correctly? What are the cases such a statement will misfunction? I would like to thank you in advace for your help. Best Regards Alex __ 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. [[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] Using Java methods in R
I guess your failure of getting two dimensional array may be related to this : http://www.rforge.net/rJava/news.html 0.9-0 (under development) o fixes issues introduced by several new features in the late 0.8 series. Most imporantly .jarray() and .jevalArray() behave as intended (and as implemented in previous versions). The same applies to .jcall() behavior with respect to arrays and its evalArray arument. The defaults for some new arguments have been changed to reflect the original behavior. o .jevalArray() has an additional argument `simplify' which allows multi-dimensional arrays to be converted to native R types. Use with care - it may convert more recursive types in the future so it should be used preferrably where you have control over the types converted. o fixed a bug in .jevalArray that was not simplifying string vectors correctly when the array type was not specified (.jclass returns dot notation whereas signatures use JNI notation so a conversion was necessary) So for multi-dimensional array, the.jevalArrayfunction has not been fully implemented in rJava release. As for the static double field con0dbl, it's pretty weild since it works well when I tested your code. One more notice, ar34Ret[2][3] should be ar34Ret[2,3] in R. At 2011-04-27 04:01:00£¬hill0093 hill0...@umn.edu wrote: Thanks Icn for pointing that out, but I don't understand it. My use of .jcall to return a type double scalar or String worked. My use of .jfield to get a one dimensional static array worked. My use of .jfield to get a static scalar constant did not work. My use of .jfield to get a two dimensional static constant array did not work. I don't understand the remainder of my rjava trial. The C:/ad/j/CalqsLin java code is: public final static double con0dbl=10001; public final static double[]con1Arr=new double[] { 10001,10002,10003,10004,10005,10006 }; public final static double[][]con2Arr=new double[][] { { 10001,10002,10003,10004 },{ 20001,20002,20003,20004 },{ 30001,30002,30003,30004 } }; public final static double[][] arReturnTEST() { double[][]retArr=new double[3][4]; for(int i=0;i3;i++)for(int j=0;j4;j++)retArr[i][j]=i*1000+j; return(retArr); } I have the RGui with R Console on the screen; here is the trial: On the top pullDowns: Packages Install Packages USA(IA) rJava library(rJava) .jinit() [1] 0 .jaddClassPath(C:/ad/j) print(.jclassPath()) [1] C:\\Users\\ENVY17\\Documents\\R\\win-library\\2.12\\rJava\\java [2] C:\\ad\\j qsLin - .jnew(CalqsLin) calStg - 20110424235959 print(calStg) [1] 20110424235959 dblTim - .jcall(qsLin,returnSig=D,linTimOfCalqsStgIsLev,calStg,as.integer(-4)) print(dblTim,digits=20) [1] 63470908799 calStg - .jcall(qsLin,returnSig=S,calqsStgOfLinTimIsLev,dblTim,as.integer(-4)) print(calStg) [1] 20110424235959 conn1Arr - .jfield(qsLin,sig=[D,con1Arr) print(conn1Arr) [1] 10001 10002 10003 10004 10005 10006 conn0dbl - .jfield(qsLin,sig=D,con0dbl) Error in .jfield(qsLin, sig = D, con0dbl) : RgetField: field con0dbl not found arj34Ret - .jcall(qsLin,returnSig=[[D,arReturnTEST) print(arj34Ret[2][3],digits=15) [[1]] NULL print(arj34Ret,digits=15) [[1]] [1] Java-Array-Object[D:[D@1d58aae [[2]] [1] Java-Array-Object[D:[D@83cc67 [[3]] [1] Java-Array-Object[D:[D@e09713 ar34Ret - .jevalArray(arj34Ret) Error in .jevalArray(arj34Ret) : object is not a Java object reference (jobjRef/jarrayRef). print(ar34Ret[2][3],digits=15) Error in print(ar34Ret[2][3], digits = 15) : object 'ar34Ret' not found print(ar34Ret,digits=20) Error in print(ar34Ret, digits = 20) : object 'ar34Ret' not found -- View this message in context: http://r.789695.n4.nabble.com/Using-Java-methods-in-R-tp3469299p3476371.html Sent from the R help mailing list archive at Nabble.com. __ 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. [[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] Using Java methods in R
you should take a look at the doc of .jarray by input ?.jarray in the console and see related examples by example(.jarray) in the console. This is what the doc says, and your issues might be related to it: '.jevalArray' currently supports only a subset of all possible array types. Recursive arrays are handled by returning a list of references which can then be evaluated separately. At 2011-04-25 20:27:24£¬hill0093 hill0...@umn.edu wrote: So the first few posts show that I found out how to get Java functions to return type double numbers to R. The arrays are still a problem. Here is another of my attempts to understand how to get java arrays into R. The Java code in class CalqsLin for an array of constants named conArr and for a function returning an array is: public static double[][]conArr=new double[][] { { 10001,10002,10003,10004 },{ 20001,20002,20003,20004 },{ 30001,30002,30003,30004 } }; public final static double[][] arReturnTEST() { double[][]retArr=new double[3][4]; for(int i=0;i3;i++)for(int j=0;j4;j++)retArr[i][j]=i*1000+j; return(retArr); } I evidently do not know how to retrieve them in R, even with .jevalArray(): arj34Ret - .jcall(qsLin,returnSig=[[D,arReturnTEST) ar34Ret - .jevalArray(arj34Ret) Error in .jevalArray(arj34Ret) : object is not a Java object reference (jobjRef/jarrayRef). connArr - .jevalArray(qsLin.conArr) Error in .jevalArray(qsLin.conArr) : object 'qsLin.conArr' not found I need help from someone who calls Java from R. The whole session was: library(rJava) .jinit() .jaddClassPath(C:/ad/j) print(.jclassPath()) [1] C:\\Users\\ENVY17\\Documents\\R\\win-library\\2.12\\rJava\\java [2] C:\\ad\\j qsLin - .jnew(CalqsLin) calStg - 20110424235959 print(calStg) [1] 20110424235959 dblTim - .jcall(qsLin,returnSig=D,linTimOfCalqsStgIsLev,calStg,as.integer(-4)) print(dblTim,digits=20) [1] 63470908799 calStg - .jcall(qsLin,returnSig=S,calqsStgOfLinTimIsLev,dblTim,as.integer(-4)) print(calStg) [1] 20110424235959 dblTim - .jcall(qsLin,returnSig=D,linTimOfCalqsStgIsLev,calStg,as.integer(-4)) print(dblTim,digits=20) [1] 63470908799 arj34Ret - .jcall(qsLin,returnSig=[[D,arReturnTEST) ar34Ret - .jevalArray(arj34Ret) Error in .jevalArray(arj34Ret) : object is not a Java object reference (jobjRef/jarrayRef). connArr - .jevalArray(qsLin.conArr) Error in .jevalArray(qsLin.conArr) : object 'qsLin.conArr' not found -- View this message in context: http://r.789695.n4.nabble.com/Using-Java-methods-in-R-tp3469299p3473023.html Sent from the R help mailing list archive at Nabble.com. __ 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. [[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] Using Java methods in R
for(i in 1:3) for(j in 1:4) print(ar34Ret(i,j),digits=15) Error in print(ar34Ret(i, j), digits = 15) : could not find function ar34Ret The way you used ar34Ret(i, j) was actually wrong. It should be ar34Ret[i, j], if nothing else wrong. At 2011-04-25 08:06:51£¬hill0093 hill0...@umn.edu wrote: I added this R code to the bottom of the previous code and it doesn't work ar34Ret - .jcall(qsLin,returnSig=[[D,arReturnTEST) print(ar34Ret,digits=20) [[1]] [1] Java-Array-Object[D:[D@8813f2 [[2]] [1] Java-Array-Object[D:[D@1d58aae [[3]] [1] Java-Array-Object[D:[D@83cc67 for(i in 1:3) for(j in 1:4) print(ar34Ret(i,j),digits=15) Error in print(ar34Ret(i, j), digits = 15) : could not find function ar34Ret The Java code is: public final static double[][] arReturnTEST() { double[][]retArr=new double[3][4]; for(int i=0;i3;i++)for(int j=0;j4;j++)retArr[i][j]=i*1000+j; return(retArr); } R doesn't know how to print the array in the next to final line, and thinks the array is a function in the final line. Any suggestions? -- View this message in context: http://r.789695.n4.nabble.com/Using-Java-methods-in-R-tp3469299p3472308.html Sent from the R help mailing list archive at Nabble.com. __ 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. [[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] Using Java methods in R
Well, the call to Java methods should be really simple in rJava. What you had tried is actually correct, initialize jvm, create an object, then call method. For the error you met, maybe you should check .jaddClassPath. At 2011-04-23 20:58:22£¬hill0093 hill0...@umn.edu wrote: That's more than I can understand. I just need help from someone who knows. Should be a simple answer from that person. -- View this message in context: http://r.789695.n4.nabble.com/Using-Java-methods-in-R-tp3469299p3469882.html Sent from the R help mailing list archive at Nabble.com. __ 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. [[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] recommendation on r scripting tutorial?
The documents accompanying the distribution can be a good start. And a suggestion for searching help on R over Google, use r-help as a basic keyword, coz a single letter of r hardly helps you find the desired topics. 2011/4/2 Wensui Liu liuwen...@gmail.com Good morning, dear listers I am wondering if you could recommend a good tutorial / book for r scripting. thank you so much in advance! WenSui Liu Credit Risk Manager, 53 Bancorp wensui@53.com 513-295-4370 __ 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. [[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] R gui on windows how to force to always show the last line of output
CTRL+L helps. 2011/4/2 stan zimine szim...@gmail.com Hi. Googled but did not found the answer for the following little issue. how to force R gui on windows (maybe a specific setting) to always show the last line of output in the window console. My program in R makes measurements every 5 mins in indefinite loop and prints results in the console. The problem: last messages are not visible, The scrolling bar of the gui console gets shorter. I.e. you have to scroll for the last messages. Thanks if anybody knows the sol to this prob. SZ __ 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. [[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] JRI plot( )
I dont think JRI can correctly handle plots from R. In my opinion, JRI is designed mainly for data sending and receiving. Plot issues should be addressed in Java, if you use R as part of your computing engine. 2011/1/7 ying zhang ying.zh...@struq.com Hi Everyone, Thanks a lot for your guys help, I finally got it running, now I can call my R function from my java code. But there is one problem left. In my R code , it open a window and plot a curve. Once running in Java, the window did successfully opened, but nothing inside, instead of grey color. Any suggestions? Many thanks Ying [[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. [[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] Navigating web pages using R
You are talking about dig the data from a dynamic webpage. The data displayed to you, I guess, is fetched via filtering from certain database. And the dropdowns you saw in the page must be some sort of widgets to do these filtering. Some sites offer this filtering via URL parsing, where the final URL changes along with used filters. But other sites might only offer those data via embeded widgets and does no change to the URL you see. Maybe your case beongs to the second type. Maybe you can do some analysis to the source of that webpage. If you are lucky, you can find some codes dealing with the filering job. They might offer some help. :D 2011/1/5 Mike Marchywka marchy...@hotmail.com Date: Tue, 4 Jan 2011 10:54:19 -0800 From: egregory2...@yahoo.com To: r-help@r-project.org Subject: [R] Navigating web pages using R R-Help, I'm trying to obtain some data from a webpage which masks the URL from the user, so an explicit URL will not work. For example, when one navigates to the web page the URL looks something like: http://137.113.141.205/rpt34s.php?flags=1 (changed for privacy, but i'm not sure you could access it anyways since it's internal to the agency I work for). LOL, presuming you are not a disgruntled employee, it is always amusing to see some entity with a fancy cryptic web design drink their own Koolaid :) This is the most annoying kind of code to write, especially when there is no reason such as revenue model to make it hard to get. I've posted in other forums about the general need for an API if you are providing data to others in a non-hostile setting. The site has three drop-down menus for Site, Month, and Year. When a combination is selected of these, the resulting URL is always http://137.113.141.205/rpt34s (nothing changes, except flags=1 is dropped, so what I need to be able to do is write something that will navigate to the original URL, then select some combination of Site, Month, and Year, and then submit the query to the site to navigate to the page with the data. Is this a capability that R has as a language? Unfortunately, I'm unfamiliar with html or php programming, so if this question belongs in a forum on that I apologize. I'm trying to centralize all of my code for my analysis in R! I'm sure that ultimately you can code this in R but for digging out what you need there may be better approaches. First I would try to contact the page author or determine if there is a better way to get the same data. Failing that, you may be able to find a form section in the html and copy that. Firefox is supposed to have something called firebug to let you see what the page does but I've never actually used that. Generally I use linux or cygwin command line tools to diagnose this junk, R may support some of these features but this is a common issue outside of R too and so it may be worth while learning the other tools. If all else fails, downloading a local copy of the page etc, you may be able to do a packet capture and just see what it does by brute force. From what I have seen, the R tools are pretty much named after the linux tools, curl for example. Thank you, -Erik Gregory Student Assistant, California EPA CSU Sacramento, Mathematics __ 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. [[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] Converting Fortran or C++ etc to R
I did a quick search for interfacing R and Fortran. Found this past information. Hope it helps. :D http://r.789695.n4.nabble.com/Conerned-about-Interfacing-R-with-Fortran-td887428.html As for your actual requirement to do the convertion, I guess there'd not exist any quick ways. You have to be both familiar with R and the other language to make the rewrite work. 2011/1/5 Murray Jorgensen m...@stats.waikato.ac.nz I'm going to try my hand at converting some Fortran programs to R. Does anyone know of any good articles giving hints at such tasks? I will post a selective summary of my gleanings. Cheers, Murray -- Dr Murray Jorgensen http://www.stats.waikato.ac.nz/Staff/maj.html Department of Statistics, University of Waikato, Hamilton, New Zealand Email: m...@waikato.ac.nzFax 7 838 4155 Phone +64 7 838 4773 wkHome +64 7 825 0441 Mobile 021 0200 8350 __ 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. [[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] Odp: R-way to doing this?
Aggreed. R's own way of handling logrithm of a negative number makes scripting more automatic, which is actually desireable. To flag any problems that might occur in calculation, do it ahead of using logrithm or in other similar situations. Try test functions like is.nan(), is.finite(), or relational operators like 0, 0. 2010/12/23 Petr PIKAL petr.pi...@precheza.cz Hi r-help-boun...@r-project.org napsal dne 23.12.2010 05:13:37: Dear friends, hope I could be able to explain my problem through following example. Please consider this: set.seed(1) input - rnorm(10) input [1] -0.6264538 0.1836433 -0.8356286 1.5952808 0.3295078 -0.8204684 0.4874291 0.7383247 0.5757814 -0.3053884 tag - vector(length=10) for(i in 1:10) # if there is any error in evaluating log(input[i]) (or evaluating some function) then tag[i] = 1, otherwise tag[i] = 0 Therefore my tag vector should like: tag[1]=1, tag[2]=0, tag[3]=1, tag[4]=0, tag[5]=0... Actually R returns logarithm of a negative number as NaN, however in this example please consider R returns error when it encounters logarithm of a negative number. I do not understand above sentence well. R returns NaN not error. For error handling in loop use try or tryCatch. For simple vectorised function evaluation as log you can use is.* evaluation is.nan(log(input))*1 [1] 1 0 1 0 0 1 0 0 0 1 ifelse(is.nan(log(input)), 1,0) [1] 1 0 1 0 0 1 0 0 0 1 Regards Petr Is there any way to do above task? Thanks and regards, [[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. [[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.