[R] Correlation when one variable has zero variance (polychoric?)
Hi, I'm running this for a simulation study, so many combinations of parameter produce many predictions that I need to correlate with data. The problem I'm using rating data with 3 to 5 categories (e.g., too low, correct, too high). The underlying continuous scales should be normal, so I chose the polychoric correlation. I'm using library(polychor) in its latest version 0.7.4 The problem is that sometimes the models predict always the same value (i.e., the median). Example frequency table: > table(med$ADRI_LAN, rate$ADRI_LAN) 2 3 4 5 3 28 179 141 50 That is, there is no variability in one of the variables (the only value is 3, the median). Pearson Product Moment Correlation consists of the covariation divided by the square root of the product of the standard deviations of the two variables. If the standard deviation of one of the variables is zero, then the denominator is zero and the correlation cannot be computed. R returns NA and a warning. If I add jitter to the variable with no variability, then I get a virtually zero, but calculable, Pearson correlation. However, when I use the polychoric correlation (using the default settings), I get just the opposite: a very high correlation! > polychoric= polychor( med$ADRI_LAN, rate$ADRI_LAN ) #, ML=T, > std.err=T > polychoric [1] 0.59 This is very counterintuitive. I also ran the same analysis in 2005 (what has changed in the package polycor since then, I don't know) and the results were different. I think back then I contrasted them with SAS and they were the same. Maybe the approximation fails in extreme cases where most of the cells are zero? Maybe the approximation was not used in the first releases of the package? But it seems that the ML estimator doesn't work at all (at least in the current version of the package) with those tables when most cells are zero due to no variability on one variable): > polychor(med$ADRI_LAN, rate$ADRI_LAN, ML=T) Error in tab * log(P) : non-conformable arrays I've seen some posts where sparse tables were trouble, eg: http://www.nabble.com/polychor-error-td5954345.html#a5954345 "You're expecting a lot out of ML to get estimates of the first couple of thresholds for rows and the first for columns. [which were mostly zeroes]" Are the polychoric estimates using the approximation completely wrong? Is there any way to compute a polychoric correlation with such a dataset? What should I conclude from data like these? Maybe using correlation is not the right thing to do. Thanks, -Jose -- Jose Quesada, PhD. http://www.andrew.cmu.edu/~jquesada __ 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] Test Driven Development in R
Hi, I wonder what kind of interest there is on Test Driven Development (TDD) in R. Test Driven Development consists of writing the test before the function, and iteratively build the function until it passes the test. Python and Ruby (specially Ruby) have very strong test-oriented cultures. In fact, in Ruby at least the custom is to do TDD and lately Behavior-driven development (BDD). In BDD, one writes a story of what one would want the code to do. This story is almost native English, and then the test suite converts it into something that the language understand as tests. There are some posts on the list about this, but they are about testing in general (Runit), not TDD. Example: http://thread.gmane.org/gmane.comp.lang.r.general/85047 Recently, I found there is an alpha, but working implementation of TDD for Komodo edit: www.sciviews.org/SciViews-K/index.html The editor has a green bar that becomes red as soon as one edits a function, and that edit breaks the tests. This is tremendously useful. Using Gmane search, the only mention I could find on svUnit was: http://thread.gmane.org/gmane.comp.lang.r.general/136632/focus=136662 I think this could make a great UseR 2009 talk. Ideally, by someone with more R experience than me, and even more ideally by Philippe Grosjean :), but it push comes to shove, I could prepare such a talk. Would this be interesting at all? Are there any resources that I have missed? How many people are using this kind of testing or Komodo -sciViews at all? Best, -Jose -- Jose Quesada, PhD. Max Planck Institute, Human Development, Berlin http://www.josequesada.name/ __ 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] R vs Python performance-wise
Hi, Has anyone run any R vs Python (numpy) tests? I'd love to see what the differences performance-wise are, specially handling large sparse matrices. Since both rely on external C code, there might not be much of a difference. If you know and use both languages, what are the main differences and what made you stick to one over another? I also noticed that there are strong libraries for social networks on both. python: networkX: https://networkx.lanl.gov/wiki pySNA: http://www.menslibera.com.tr/pysna/ R: sna, network etc. see: http://www.jstatsoft.org/v24 Has anyone run a bechmark of the two systems doing the same operation? Which is the right environment for large social networks? Some packages have bindings for both languages, and of course, there's a reliable way to bind the two languages together, Rpy: http://rpy.sourceforge.net/ So this may not be a big deal which one to pick. Thanks, -Jose -- Jose Quesada, PhD. Max Planck Institute, Human Development, Berlin http://www.andrew.cmu.edu/~jquesada __ 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] Working with RDF
Dear list, I will be working with RDF in the future, and was wondering if there's anyone else in this list doing this. Any libraries/resources to check? Thanks, -Jose -- Jose Quesada, PhD. Max Planck Institute, Human Development, Berlin http://www.josequesada.name/ __ 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] twitter useRs?
I wonder if there are any useRs sharing day-to-day realizations/tricks on twitter... Seems like a good place for those things that are good findings, but one is too lazy to blog about them... -- Jose Quesada, PhD. Max Planck Institute, Human Development, Berlin http://www.josequesada.name/ __ 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 and vim (gvim) on ubuntu
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 > when I try to run an R command eg, "x <- rnorm(100,10,5)" vim returns this > error: > "~/.pipe" E212: can't open file for wirting" Hi Andreas, I'd recommend to use this script instead. It uses screen to communicate R and vim, it works well. http://www.vim.org/scripts/script.php?script_id=2551 Best, - -Jose - -- Jose Quesada, PhD. Max Planck Institute, Center for Adaptive Behavior and cognition, Berlin http://www.josequesada.name/ -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iQIVAwUBSbG4b2MobUVGH+HKAQLovRAAv/X2tRiZwRB6m+MCLG1wuBDyR5mVDmIH Ox+yrWxusxS+5ezHjasR9usVsF6PxN7C+mK9zdeFQhxrO93F8dDsCvW1B+Qq51f4 s6+lY9pPmn7SKTfIpr6PlkvLVf38y++yMLvqMCnXfu+PXENe6degY+KEtykCbQDa /gtE00zu/RYY5VslJj3/DQncJjBR7zvmyDkVTKZA7j4BTKlP6N48JDRgjd1IThrd oyUVV4JM87Sy/1rqx1/WXVV6F+9fcmRV/nF9RWjFyNaT8ILlNlrhHR6EtDj8mz0h vUs831YxUWu4o9aaioZsbMNAFQRX9uyUf+LjXj7TyRlznJgQ7ih+HJmOb7/dJD4d vQpgFQUNU31+oYwk75zvtO8tSqNsUp5qHBaZ8dSZjCEoSGARSRukhtyfLK92VrCz 2J9aSajOFUZ4/HKsu+1TJhYjOcZXgFXJo8qUQPKBt973t3N7lvIlE9/F/rq7u8Si eC5tyrm6LyUNXKKbjaS9jOyXBWfI+P3zj+i3Qo/2nmetegtmgNxYuTJlu8DFtiik gPS+BDXycrw2f8jOOJxZJ/25nsynTFQh6rAy89ZAu7GqeVFsJlwe5Gh7M64xAflG vhmnpESTFhVEGxu+CC71/PO1imbd69WDE69drF9UxTHQ7Bp6mGhI4E/1+0uXgCfN 6fJVnAMdJ9w= =iPvx -END PGP SIGNATURE- __ 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] using chm help files under linux
Hi, Chm (compiled help) is a microsoft invention. It's the default help system under windows, but not so under linux. I found that (at times) I like better how chm help looks. Since there are chm viewers under linux, using chm help files should be possible. Has anybody tried to set R so it opens chm by default? I'm sure there's some flag or Rprofile var that could get this done. Thanks, -- -Jose -- Jose Quesada, PhD http://josequesada.name __ 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] Comparison of data analysis packages: R, Matlab, SciPy, Excel, SAS, SPSS, Stata - Brendan O'Connor's Blog
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi All, I found an interesting thread discussing R and other packages here: http://anyall.org/blog/2009/02/comparison-of-data-analysis-packages-r-matlab-scipy-excel-sas-spss-stata/ Plenty of well-reasoned comments. I thought it may be informative for people on this list. Best, - -Jose - -- Jose Quesada, PhD. Max Planck Institute, Center for Adaptive Behavior and cognition, Berlin http://www.josequesada.name/ -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iQIVAwUBSbvhbGMobUVGH+HKAQKVzg//T3FOXQYSoTaqs5dHeu6V8fyTjmHYPmKZ TyDbXTBVJqs8cQiP0fc1V2pq0r8CAdj4NTRsSpO2XKVUSF8TSa7/8afhlFk8WzDW 8pGVC+PWTJhYJmZbnG06+sNtiv586DwOx1cBnMW6xJ/1jiWWykDQrQLKoidBDYxM b1yFdezu7+PsKNO7eyymceGf3No1bYtcxpjB82JkcmUK+13eriZOtILXEntCPgpf a0q48NRKhluMzpSt8mjyKnFUIOZ6fPbDyUWAdQdAwU6Gh6Pkfe8entW+yzzSJnDL GUlhJNBNUjhNfaogcBJjnyrrVU0XvMrAW5t3GSMZd3ItIHuPS1TdOIndtEsohYjB DPXLcpbdgjxBvfVVobVxaAQ5tITH0Wd0AFdQVKUW9N7ThtiRK7Y3EfyGnx4NIRIl 9TWLc5L2TBCJHJeYGZCNwDBS0MHjJMcggcCFcvWfJUlU17YDiUP5TqA3UbJY4roB JIjGrWx8aOU88Wdw15lU6j5yWIJUvbHfjc69R0QsdgSnf6XpGOO+7IsxVufZLN9j fdAA2ydSY2aZYIg9gli/S1n5DjmF/aJOLtePWXYZ79ikoheiGn8CQAgYZi7muPvR kI2pv9HR9YNGnfI4qcA/YkgzFVSktdy/anMQQ+6D2LeMMJYEwOF2y6KXSevNDbl5 kNesp3BYlZs= =cFnL -END PGP SIGNATURE- __ 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] dpaste, pastebin etc. Syntax highlighting for R?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi All, There are many sites to get bite-sized chuncks of code. The nice thing is that they use syntax highlighting. Examples: http://dpaste.com/ http://pastie.org/ http://pastebin.com/ Twitter with a link to a syntax highlighting site would do wonders. There are plugins for most (good) editors to post directly to the site from the editor. Example: http://www.vim.org/scripts/script.php?script_id=1624 The wiki shows that there are good working solutions to get R syntax highlighting coverted to html. The code for such a thing is here: http://www.andre-simon.de/ Does anyone know of any of those pastebin-like sites that uses R-friendly syntax highlighting? Hmm, I had another idea, but maybe I'll use an independent thread. - -Jose - -- Jose Quesada, PhD. Max Planck Institute, Center for Adaptive Behavior and cognition, Berlin http://www.josequesada.name/ -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iQIVAwUBSb6OIGMobUVGH+HKAQI5kQ//cpxdTFSEskP1M1bOCYWBVOYlsnBxxNAt lg/N3AMk1dpDNWXkhVi8GPrnfjjh76rT2XAVkbNr/uu0iRDsucsFFmHF2C6zXYPm cwpIMlEfY+rWdyEdUq3AayTYviHlp4HQWIXRLJX7B35auUwMORXN5KS1i+djo+Lh OnTQqFc8adZakjHUy347YZxfT4l0iaAA+UdJB1Q6JQWLM2CiIPRwe7EOh6fZeUVU 02NQbkFVim+iMmTk8K+ZRU3NZUigBaJ9utFxJV1N5sosPtRmRSG+YhdvpI99JSTW uhSX0LlyqEkzAsDLFjXOF7ZWyWEGqRKEf51Z+4YCw3Dgzbn7TkCw/FozNaSXHZOx mms+rngUftSR1Q58bZVbx5WQwqD3Jbujqu0DsFmcNNP5220vYbaJ7r7Ei56WFzuG ShJgP7JkdejQRDFNYDF/BtHGkbaXFD8su75DSwYA3bNr6DBFbC1taE3nuV5X++IH qonlrrR/1pCAskQwpWIKUqfLyDhDjJD5tTYDylg+yPkncoBOFBMo+BvMk4faas4b KGxUdVqeOSGolXoN2m1P2lUOKjy6pOVsYuZQUSCZRH3tK5prkEMhGmSdLtCdjnjC vbEkhy4i9qSZOKmITLsBjk0Tx5z0RuN3xlcs1moYF7EXjJIXYQlHFsfAQqqIAxAC SdYl6u/1Jx0= =r7BH -END PGP SIGNATURE- __ 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] R-code in html help pages: syntax highlighting
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, A follow up to my previous post. It'd be good to have syntax highlighting in the html help pages. There is highlight (http://www.andre-simon.de/) which seems to be open source. Since code is delimited in the help file format, it should not be too difficult to run a highlighting program (actually, vim and emacs do this too) recursively and pretty-print all the R examples in the entire CRAN. Including the highlighter with R, or whatever supplementary tools people use to make R html help files could simplify things. I've never written docs or released a package, so I may be understimating the effort it'd take to get this working. Using the r-help gmane archives also leads to plain code. This is probably more trouble than it's worth, since there's no metadata delimiting a block of code and it might be difficult... but grepping through all R-help posts and coloring code would be really nice too. Again, this lands straight into 'nice to have, but not essential' territory. If anyone wants to do this, feel free to. Best, - -J - -- Jose Quesada, PhD. Max Planck Institute, Center for Adaptive Behavior and cognition, Berlin http://www.josequesada.name/ -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iQIVAwUBSb6RRGMobUVGH+HKAQI2RxAAijNIj7qlBogc9M6lhQ2Ah1Px29iU/uzS 45t5blwNSGVSbAbZF7N7rRcBdn8/c4W8n+oI62nnap0snwLMFW/ynikVNJuBY+XA +yNaO5nIJo5SWu60WkcMinm/ysPZ4o4Jdxr1+lGfJ/ceVSTWPWVLb//GN8QElgwT Vf0ZQUSqfWczzeVDSDtfMKGTJOz4y60eF5hounA/PkzyUd8RRo1WpEXzJHYsCTI+ RwBrYZ5Q30cpKLAJQNeiiv8GDtv7QvJl38uRAqBRK5Ec9CGC0brGZquX8UgHi1q1 1+NzHSt95E4Y0CKWPS48t+eO58MUE8v69gjLa9DdnhII4tCdAUURuP+AsaFm+hzP a7OufMNnh/S8igDmqon0c9W6sJrkDo9DdrZPlu6MFjGQ5SbS6mSfvwSRKVd3RTCN 2/+uz0EwBygq1OKS+Z7Z+kx29UR8+bNXOGaPRlsr5CKcwVV9w3FBvEICuDaP75vj l0d75+2R+CB/R/e2+dMMRCQY5MNWtYuuqoz3jNws59J+0z5K35usLoaKdB7Ez3D6 G2CCBKJSrugT0s8OkhX5pcTiU6NUIrq6q8h7JNEeuR0bniFClXlDrAs9iIdNb4PS oFpqtNJWPLaicHRMnJdnxPCriHa0lmI3QVoGrf6UFtBAXuiOkFxcHUmTcQczyfOm IGyGcgCko3o= =djsT -END PGP SIGNATURE- __ 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 do I set the working directory when using ESS and R under windows?
Hi, While I'm a devoted vim user, I'm testing ESS :) How do I set the working directory when using ESS and R under windows? When I try to launch R, it asks for a directory. In windows, it simply doesn't let you pick a directory on the 'open' dialog. It may be a problem with windows server 2008 64 bit, though, as it seems really basic. Thanks. Best, -Jose -- Jose Quesada, PhD. Max Planck Institute, Center for Adaptive Behavior and Cognition -ABC-, Lentzeallee 94, office 224, 14195 Berlin http://www.josequesada.name/ __ 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] RMySQL and non-installer mysql
Hi all, I'm running mysql on windows server 2008 64, but I just unzipped files. There's no installer and no registry entry. When using RMySQL, it seems that it needs to look at the registry: > library("RMySQL") Loading required package: DBI Error in utils::readRegistry("SOFTWARE\\MySQL AB", hive = "HLM", maxdepth = 2) : Registry key 'S' not found Error : .onLoad failed in 'loadNamespace' for 'RMySQL' Error: package/namespace load failed for 'RMySQL' Thus, it finds nothing. Is there any workaround? Thanks! -- Jose Quesada, PhD. Max Planck Institute, Center for Adaptive Behavior and Cognition -ABC-, Lentzeallee 94, office 224, 14195 Berlin http://www.josequesada.name/ __ 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] Rmysql linking to an old-ish mysql build
Hi, I'm trying to get Rmysql to work o windows server 2008 64-bit. I have the latest build of mysql installed (mysql-5.1.34-winx64). When trying to load Rmysql, I got a warning that Rmysql is linking to an old-ish mysql build (5.0.67). I could do some basic stuff (the connection works) but it breaks when trying to read a large table. So I set up to use the buld 5.0.67 that Rmysql likes. 10 hrs later and after lots of sysadmin work, I have to call it quits. I couldn't make it work. Since this mysql 5.0.67 is pretty old, I was wondering if anyone has binaries for Rmysql that work for a more recent version. Maybe the authors of the package have plans to update it soon? I've tried the package on both R 2.9.0 and R2.8.1. If nothing comes up, I'll try to spend a few more hours on getting the old version to work. Thanks! Best, -Jose -- Jose Quesada, PhD. Max Planck Institute, Center for Adaptive Behavior and Cognition -ABC-, Lentzeallee 94, office 224, 14195 Berlin http://www.josequesada.name/ __ 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] Vim R plugin-2
Jakson A. Aquino gmail.com> writes: > > Dear R users, > > People who uses vim in Linux/Unix may be interested in checking the > plugin for R that I'm developing: > > http://www.vim.org/scripts/script.php?script_id=2628 > > The plugin includes omni completion for R objects, code indentation > and communication with R running in a terminal emulator (xterm or > gnome-terminal). This last feature was already present in Johannes > Ranke's plugin. > > I would like to know if you have any suggestions of improvements. > > Best regards, > Excellent work! I wonder if this could be made more portable (e.g., it depends on perl, + R being on a tty terminal, which is not always the case). I'll try to look at it and see if I can port it so it works on windows. But the current communication method I use there are just the clipboard, not sure if it'll be possible. Any alternative ways of sending info both ways from R to any open process (vim) in windows? I have, and like, perl; the only think that is missing is the tty support on windows (I think!) -- Jose Quesada, PhD. Max Planck Institute, Center for Adaptive Behavior and Cognition -ABC-, Lentzeallee 94, office 224, 14195 Berlin http://www.josequesada.name/ __ 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] Vim R plugin-2
Jakson Alves de Aquino wrote: > Jose Quesada wrote: > >> I'll try to look at it and see if I can port it so it works on windows. >> But the >> current communication method I use there are just the clipboard, not sure if >> it'll be possible. >> > > Unfortunately, I cannot help on Windows environment. > > >> Any alternative ways of sending info both ways from R to any open >> process (vim) >> in windows? >> > > Netbeans could be a fast and portable route for communication between R > and vim without the need of using either pipes or files saved in disk as > intermediary. Typing ":help netbeans" in vim should show netbeans > documentation. R also has TCP support: write.socket(), read.socket(), > etc. We could begin to explore this route... > > Great finding! I wish I had more time to dedicate to this. Have you seen: http://pyclewn.wiki.sourceforge.net/features+ In my view, R as a language is very good but the tools around it are not good. When a matlab person tries R, their first comments are always how poor the environment is. Sure, one can have a debugger (with a crappy GUI in TK), and there's some editor support, but it's kind of painful. Integreting an R debugger with something like pyclewn would be very good. Best, -jose -- Jose Quesada, PhD. Max Planck Institute, Center for Adaptive Behavior and Cognition -ABC-, Lentzeallee 94, office 224, 14195 Berlin http://www.josequesada.name/ __ 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] alternative to built-in data editor
Hi all, I often have to peek at large data. While head and tail are convenient, at times I'd like some more comprehensive. I guess I debug better in a more visual way? I was wondering if there's a way to override the default data editor. I could of course dump to a txt file, and look at it with an editor/spreadsheet, but after doing it a few times, it gets boring. Maybe it's time for me to write a function to automatize the process? I'd ask first in case there's an easier way. Thanks! -Jose -- Jose Quesada, PhD. Max Planck Institute, Center for Adaptive Behavior and Cognition -ABC-, Lentzeallee 94, office 224, 14195 Berlin http://www.josequesada.name/ __ 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] a simple trick to get autoclose parenthesis on windows
Hi, This is a simple trick to get autoclose parenthesis on windows. If you like how StatET autocloses parens, but like to use the lighter Vanilla R, you can use autohotkey (http://autohotkey.net) to provide this functionality. Simply put the below code in a text file, rename extension as .ahk and doubleclick on it to execute. -- code starts here 8< -- ; Vanilla R ; = #IfWinActive, ahk_class Rgui ; autoclose parens (::Send (){left} "::Send ""{left} return -- code ends here 8< -- Silly, but I find it very convenient. Best, -Jose -- Jose Quesada, PhD. Max Planck Institute, Center for Adaptive Behavior and Cognition -ABC-, Lentzeallee 94, office 224, 14195 Berlin http://www.josequesada.name/ __ 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] a simple trick to get autoclose parenthesis on windows
Gabor Grothendieck wrote: > Hi, I was looking for your sendcodetoR.ahk autohotkey script > but couldn't find it. Would you be able to point me to it. > Thanks. > Here's what I have right now, it also maps right alt to send code to R. You should change the ahk_class to your editor of choice (here it's vim). To get the ahk_class, you need to run the atoit_spy (comes with every autohotkey install). HTH, -Jose ; F3 and right alt will send selection to open Rgui #WinActivateForce F3:: IfWinExist, ahk_class Rgui { Send ^c; copy selection to clipboard WinActivate ; R Console save = %clipboard% sendinput, {Raw}%save% sendinput,{enter} Sleep 1000 WinActivate, ahk_class Vim } Ralt:: IfWinExist, ahk_class Rgui { Send ^c; copy selection to clipboard WinActivate ; R Console save = %clipboard% sendinput, {Raw}%save% sendinput,{enter} Sleep 1000 WinActivate, ahk_class Vim } return -- Jose Quesada, PhD. Max Planck Institute, Center for Adaptive Behavior and Cognition -ABC-, Lentzeallee 94, office 224, 14195 Berlin http://www.josequesada.name/ __ 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] Scrolling behavior in View()
Hi, I've realized that the scrolling behavior in View() is unlike most other applications. It seems that the minimum scroll size is very large for large objects( i.e., a vector of 1M integers), and it might be that this scroll is proportional to the size of the object. Try this: a = 1:100 View(a) Click once on the scroll arrow down. It will move to item 1001. It could be that the scroll size is 1/1000 object length. If this is so, it's a bit of a problem, since there's no way to View say cell 500... unless one does a View(head(a, 500)), which kind of defeats the point of view. Is this behavior by design? If so, wouldn't it be better to make it optional (as it breaks GUI conventions of mostly any OS for scrolling behavior)? An argument for view to turn this off would be great. Thanks! Best, -Jose -- Jose Quesada, PhD. Max Planck Institute, Center for Adaptive Behavior and Cognition -ABC-, Lentzeallee 94, office 224, 14195 Berlin http://www.josequesada.name/ __ 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.