Re: [R] Transformations in Tidyverse (renaming and ordering columns)
I don't know much about the Tidyverse, but more generally the way to represent ordered categorical data is with a factor. This seems to work: > testset$Observation <- factor(testset$Observation, levels=c("One", "Two", "Three")) > testset$Label <- factor(testset$Label, levels=c("Western", "Northern", "Eastern", "Southern")) > testset %>% select(Observation, Label, Value) %>% spread(key=Observation, value=Value) # A tibble: 4 x 4 Label One Two Three 1 Western163 147 119 2 Northern 105 10082 3 Eastern121 10690 4 Southern747065 JL On Mon, Oct 22, 2018 at 7:55 PM Joel Maxuel wrote: > For clarity sake. More show (with example closer to reality), less tell. > :^) > > ## Current: > > > library(knitr) > > library(tidyverse) > ── Conflicts > ─ > tidyverse_conflicts() ── > x dplyr::filter() masks stats::filter() > x dplyr::lag()masks stats::lag() > > library(tibble) > > library(dplyr) > > > > testset <- as_tibble(tribble(~SN, ~Section, ~Order, ~Observation, ~Seq, > ~Label, ~Value, > + 2, "For Reporting Quarter", 1, "One", 1, > "Western", 163, > + 2, "For Reporting Quarter", 1, "One", 2, > "Northern", 105, > + 2, "For Reporting Quarter", 1, "One", 3, > "Eastern", 121, > + 2, "For Reporting Quarter", 1, "One", 4, > "Southern", 74, > + 2, "For Reporting Quarter", 2, "Two", 1, > "Western", 147, > + 2, "For Reporting Quarter", 2, "Two", 2, > "Northern", 100, > + 2, "For Reporting Quarter", 2, "Two", 3, > "Eastern", 106, > + 2, "For Reporting Quarter", 2, "Two", 4, > "Southern", 70, > + 2, "For Reporting Quarter", 3, "Three", 1, > "Western", 119, > + 2, "For Reporting Quarter", 3, "Three", 2, > "Northern", 82, > + 2, "For Reporting Quarter", 3, "Three", 3, > "Eastern", 90, > + 2, "For Reporting Quarter", 3, "Three", 4, > "Southern", 65)) > > testset %>% select(Observation, Label, Value) %>% spread(key=Observation, > value=Value) > # A tibble: 4 x 4 > Label One Three Two > > 1 Eastern12190 106 > 2 Northern 10582 100 > 3 Southern746570 > 4 Western163 119 147 > > > > ## Intended: > > # A tibble: 4 x 4 > For Reporting Quarter One Two Three > > 1 Western 163 147 119 > 2 Northern 105 10082 > 3 Eastern121 10690 > 4 Southern 74 70 65 > > > > ## > > Unfortunately I don't know how to get there from here. Section, Order and > Seq are there to assist with getting the data to the right output > programmatically, however I don't know how to make use of them. > > Hope this helps. > > -- > Cheers, > Joel Maxuel > > > On Mon, Oct 22, 2018 at 6:18 PM Jeff Newmiller > wrote: > > > If you are willing to work in the context of LaTeX output then perhaps > you > > will find the "tables" package useful. However, while you think you have > > communicated clearly enough regarding what you want to accomplish, I do > > not, so either someone else will intuit what you want or you will create > a > > mock-up of what you want your output to look like to remove the > guesswork. > > > > > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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 -- To UNSUBSCRIBE and more, see 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] Rbbg usurped ?
I've cleaned up the findata repository, you should now be able to install Rbbg as expected. But that said, the package is no longer being actively developed. Recent efforts have been taking place in the Rblpapi package. The interface is similar, though not strictly compatible. If you're doing much work with Bloomberg data I recommend you check it out. JL On Dec 28, 2016 5:39 AM, "Sarah Goslee"wrote: > If you actually visit that link, you will see that the directory structure > isn't laid out in the way that install.packages() currently expects for a > repo, but that you can still download the package yourself, and presumably > install it from local file. > > > On Wed, Dec 28, 2016 at 4:41 AM Tolga Uzuner wrote: > > > Dear R users, > > > > > > > > I have some old code that was using Rbbg, which no longer appears to be > > > > working. > > > > > > > > I tried to download Rbbg using the line: > > > > install.packages("Rbbg", repos = "http://r.findata.org;) > > > > > > > > in R version 3.3.2 on a Windows 10 machine and got the following error: > > > > > > > > > install.packages("Rbbg", repos = "http://r.findata.org;) > > > > Installing package into ‘C:/Users/Tolga/Documents/R/win-library/3.3’ > > > > (as ‘lib’ is unspecified) > > > > Warning: unable to access index for repository > > > > http://r.findata.org/src/contrib: > > > >cannot open URL 'http://r.findata.org/src/contrib/PACKAGES' > > > > Warning: unable to access index for repository > > > > http://r.findata.org/bin/windows/contrib/3.3: > > > >cannot open URL 'http://r.findata.org/bin/ > windows/contrib/3.3/PACKAGES' > > > > Warning message: > > > > package ‘Rbbg’ is not available (for R version 3.3.2) > > > > > > > > > > > > > Is Rbbg no longer supported ? Has it been usurped by something else ? > > > > Does this mean I have to rewrite code or is the new package compatible > > > > with code written for Rbbg ? > > > > > > > > Thanks in advance > > > > > > > > __ > > > > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > > > > 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 -- To UNSUBSCRIBE and more, see > 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 -- To UNSUBSCRIBE and more, see 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] Getting rid of unwanted csv files
?file.info On Wed, Nov 18, 2015 at 6:12 AM, WRAY NICHOLASwrote: > Hi I have got a large folder with hundreds of csv files in it The > problem is > that some of them are junk, and I know which ones are junk because they > were > created on certain days, that is before I had honed the programme > generating > them to ultimate perfection > > I'd like to get shot of the junk files, but I can't distinguish them by > names/label from the ones I want to keep -- the only criterion is the date > of > making them, but I cannot see a way of telling R to look at the date > rather than > the name/label Obviously I could plough by hand, but there are loads and > if > anyone has any ideas I'd be grateful > > Thanks, Nick Wray > > PS Just had a thought -- Going off R-piste now but of course is it poss to > get > rid of them within Windows (which I'm using) rather than R itself? > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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 -- To UNSUBSCRIBE and more, see 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] Transfer a 3-dimensional array to a matrix in R
> x <- array(1:18, dim=c(3, 2, 3)) > x , , 1 [,1] [,2] [1,]14 [2,]25 [3,]36 , , 2 [,1] [,2] [1,]7 10 [2,]8 11 [3,]9 12 , , 3 [,1] [,2] [1,] 13 16 [2,] 14 17 [3,] 15 18 > apply(x, 3, t) [,1] [,2] [,3] [1,]17 13 [2,]4 10 16 [3,]28 14 [4,]5 11 17 [5,]39 15 [6,]6 12 18 On Tue, Oct 20, 2015 at 12:39 PM, Chunyu Dongwrote: > Hello! > > > Recently I am trying to transfer a large 3-dimensional array to a matrix. > For example, a array like: > , , 1 > [,1] [,2] > [1,]14 > [2,]25 > [3,]36 > , , 2 > [,1] [,2] > [1,]7 10 > [2,]8 11 > [3,]9 12 > , , 3 > [,1] [,2] > [1,] 13 16 > [2,] 14 17 > [3,] 15 18 > > > I would like to transfer it to a matrix like: > 17 13 > 41016 > 28 14 > 51117 > 39 15 > 61218 > > > Could you tell me how to do it in R ? Thank you very much! > > > Best regards, > Chunyu > > > > > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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 -- To UNSUBSCRIBE and more, see 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 problem with string handling to make a time duration
Regular expressions are the tool for this problem. This pattern matches your input data: t - c(10H20M33S, 1H1M, 1M, 21M9S, 2H55S) patt - ^(([0-9]+)H)?(([0-9]+)M)?(([0-9]+)S)?$ all(grepl(patt, t)) # TRUE We can use the pattern to extract hour/minute/second components hms - lapply(c(h=\\2, m=\\4, s=\\6), function(r) sub(patt, r, t)) And then just plug those components back into the desired format formatted - gsub( , 0, sprintf(%2s:%2s:%2s, hms$h, hms$m, hms$s)) In the last line we need the gsub because zero-padding with %02s seems to be platform-dependent. JL On Mon, May 4, 2015 at 3:59 PM, gavinr g.ru...@bham.ac.uk wrote: I have a character string that represents a time duration. It has an hours minutes seconds structure(ish) but with letters denoting units (H,M or S) no leading zeros and no placeholder at all where one or other of the units are not required. It looks like this: t-c(10H20M33S,1H1M,1M,21M9S,2H55S )) df-data.frame(t) df #ideally should look like: t2-c(10:20:33,01:00:01,00:01:00,00:21:09,02:00:55) df2-data.frame(t2) df2 I need to get it into hours minutes and seconds either in time format or as a string with leading zeros and all three time units represented in each one, as in df2. The data, part of a very large dataset, are for onward use and processing in a GIS application. I’ve messed about with string handling statements in SQL to no avail, but wondered if R would be a better bet? I’ve had a look at some of the commands in stringr, but am unsure how to operationalise a solution using this package. Any advice is welcome. -- View this message in context: http://r.789695.n4.nabble.com/A-problem-with-string-handling-to-make-a-time-duration-tp4706795.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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 -- To UNSUBSCRIBE and more, see 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] duplicated function
That seems straightforward enough: x - c(7, 7, 7, 2, 3, 2) match(x, x) [1] 1 1 1 4 5 4 ifelse(duplicated(x), match(x, x), 0) [1] 0 1 1 0 0 4 On Tue, Nov 18, 2014 at 10:40 AM, Duncan Murdoch murdoch.dun...@gmail.com wrote: On 18/11/2014 10:23 AM, Dennis Fisher wrote: R 3.1.1 OS X Colleagues When I use the duplicated function, I often need to find both the duplicates and the original element that was duplicated. This can be accomplished with: duplicated(OBJECT) | duplicated(OBJECT, fromLast=TRUE) From my perspective, an improvement in the duplicated function would be an option that accomplishes this with a single call to the function. This could either be: 1. a new option: all=TRUE (pick whatever name makes sense) 2. allowing fromLast to take a new value (e.g., NA, in the spirit of the xpd option in par()) If my suggestion would yield unintended consequences, it can certainly be ignored. The duplicated() function is pretty fast, so what's wrong with your original version? If you find it to be too much typing, wouldn't it be simplest to write your own function, e.g. nonunique - function(x) duplicated(x) | duplicated(x, fromLast=TRUE) ? Something I've wanted more than once is a variation on duplicated that returns the index of the duplicated element, so for example dupindex(c(7,7,7,2,3,2)) would return 0 1 1 0 0 4 or possibly 1 1 1 4 5 4 Duncan Murdoch __ 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] xts Annual series
At first pass it would seem that 'integer' would make a perfectly fine year class. But for some reason it's disallowed: xts(rnorm(8), 2000L:2007) Error in xts(rnorm(8), 2000L:2007) : order.by requires an appropriate time-based object Which is a bit unexpected, since xts descends from zoo and this works fine: zoo(rnorm(8), 2000L:2007) 2000 2001 2002 2003 2004 2005 2006 2007 0.2963980 -1.7928750 1.9253476 -0.6851739 0.3223047 0.7776734 -0.3255266 -1.0980489 That doesn't feel very eXtensible to me. -John On Tue, Apr 8, 2014 at 4:27 PM, Michael Weylandt michael.weyla...@gmail.com wrote: On Apr 8, 2014, at 15:15, Erin Hodgess erinm.hodg...@gmail.com wrote: Hello! If I have the following: x - as.yearqtr(2000 + seq(0,7)/4) x [1] 2000 Q1 2000 Q2 ... which is as it should be. Then if I set up time as time - xts(1:8,x) time 2000 Q1 1 2000 Q2 2 2000 Q3 3 . . Also fine Now suppose I want to have an annual xts object. How do I go about setting that up, please? Not quite as transparently. R does not (to my knowledge) have a commonly used 'year' class. You can of course use yearqtr objects and skip 3/4 per year. Thanks, Erin -- Erin Hodgess Associate Professor Department of Computer and Mathematical Sciences University of Houston - Downtown mailto: erinm.hodg...@gmail.com [[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.
Re: [R] failure to connect to Bloomber using Rbbg from batch script on Windows
Andre, Does the batch script always fail, or is it sometimes successful? You've probably tried running in batch and interactively one after the other, but if not please do that to make sure it isn't a timing issue with the Bloomberg connection. Also, you can turn up the logging in Rbbg: conn - blpConnect(throw.ticker.errors = FALSE, log.level = finest) Maybe that will shed some light on the problem. -John On Tue, Feb 5, 2013 at 12:33 AM, Andre Zege az...@yahoo.com wrote: I am having a puzzling problem with bloomberg connection. When i run from R prompt some code that has library(Rbbg) conn - blpConnect(throw.ticker.errors = FALSE) print(connected) ... I establish connection every time and then proceed to get data when i run this code from R prompt. However, when i run this from a batch script, i get the following error output from Rbbg: = R version 2.15.2 (2012-10-26) rJava Version 0.9-4 Rbbg Version 0.4-155 Java environment initialized successfully. Adding C:\blp\API\APIv3\JavaAPI\v3.5.1.1\lib\blpapi3.jar to Java classpath simpleError in ls(envir = envir, all.names = private): invalid 'envir' argument === I looked in Rbbg and Bloomberg log files and they have the following: blpjavaapi0.log.0 === 2013/02/04 19:46:50.635 blpapi.Session.3 init [INFO] UserAgent=Library:Java;Version:3.5.1.1;OS=Name:Windows 7;Version:6.1;VMVersion:1.6.0_23;VMVendor:Sun Microsystems Inc.; 2013/02/04 19:46:50.635 blpapi.Session.3 init [INFO] SessionParameters: [ defaultServices = [//blp/mktdata, //blp/refdata], defaultSubscriptionService = //blp/mktdata, defaultTopicPrefix = ticker/, allowMultiCorrelatorsPerMsg = false, connectTimeout = 5000, clientMode = AUTO, maxPendingRequests = 1024, autoRestartOnDisconnection = false, authenticationOptions = , numStartAttempts = -1, reconnectionInterval = 3000, compat33x = false, serverAddress = [localhost:8194], keepAliveRequestInterval= 2, keepAliveResponseTimeout= 5000, maxEventQueueSize= 1, slowConsumerWarningHiWaterMark= 0.75, slowConsumerWarningLoWaterMark= 0.5] 2013/02/04 19:46:50.720 blpapi.PlatformConnection.3.Platform.0 b [INFO] Session established with: localhost/127.0.0.1:8194 2013/02/04 19:46:50.721 blpapi.Session.AuthorizationManager.3 b [INFO] AuthorizationManager connectionUp ([0/3]) 2013/02/04 19:46:50.722 blpapi.Session.AuthorizationManager.3 b [INFO] Nothing to authorize. No pre-loaded authorization requests. === org.findata.blpwrapper.0.log-1.1 Feb 4, 2013 7:40:17 PM org.findata.blpwrapper.Connection processSessionStatusEvent WARNING: SessionStartupFailure = { reason = { source = Session errorCode = 1001 category = UNCLASSIFIED description = CONNECTION_FAILURE subcategory = } } None of these error messages gives me a clue of what could be wrong. The only vague thought i have is that something about Java or rJava might not be initializing correctly. I must admit i am not used to running things on Windows, so maybe i am missing something simple. Just in case i did something stupid I simply have the following in my batch file R CMD BATCH --no-restore --no-save C:/Users/.../tmp.R C:/Users/.../tmp.out and tmp.R has a call to function that connects to Bloomberg. Batch is invoked by scheduler I am running R version 2.15.2 (2012-10-26) rJava Version 0.9-4 Rbbg Version 0.4-155 64 bit Win 7 Ultimate Would greatly appreciate any hints Andre [[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] Rbbg for 2.15.2
Tolga, The Rbbg binary for 2.15 works for the .0, .1, and .2 minor versions. The issue here is probably a change to the install.packages function that was introduced in R 2.15.2. You can get around this by first calling R options(install.packages.check.source = no) and then following with the Rbbg installation. Hope that helps, John On Mon, Jan 14, 2013 at 5:18 PM, Tolga Uzuner to...@coubros.com wrote: Dear R Users, Anyone know of a version of Rbbg compiled for R 2.15.2 . The current version does not appear to work with 2.15.2 install.packages(Rbbg, repos = http://r.findata.org;) Installing package(s) into C:/Users/t_uzu_000/Documents/** R/win-library/2.15 (as lib is unspecified) Warning: unable to access index for repository http://r.findata.org/src/** contrib http://r.findata.org/src/contrib Warning message: package Rbbg is not available (for R version 2.15.2) Thanks in advance, Tolga __** 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.html 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] littler and rJava
Hello list, I'm having some difficulty getting rJava to load in littler. Even after a R CMD javareconf and a reinstall of littler, I get this: jlaing@xenon:~$ r -e require(rJava) Loading required package: rJava Loading required package: methods Error : .onLoad failed in loadNamespace() for 'rJava', details: call: dyn.load(file, DLLpath = DLLpath, ...) error: unable to load shared object '/usr/local/lib/R/site-library/rJava/libs/rJava.so': libjvm.so: cannot open shared object file: No such file or directory It works fine with Rscript: jlaing@xenon:~$ Rscript -e require(rJava) Loading required package: rJava Loading required package: methods Presumably my load paths are misconfigured, but I can't figure out where: jlaing@xenon:~$ R CMD javareconf Java interpreter : /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java Java version : 1.6.0_24 Java home path : /usr/lib/jvm/java-6-openjdk-amd64/jre Java compiler: /usr/lib/jvm/java-6-openjdk-amd64/jre/../bin/javac Java headers gen.: /usr/lib/jvm/java-6-openjdk-amd64/jre/../bin/javah Java archive tool: /usr/lib/jvm/java-6-openjdk-amd64/jre/../bin/jar Java library path: $(JAVA_HOME)/lib/amd64/server:$(JAVA_HOME)/lib/amd64:$(JAVA_HOME)/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib JNI linker flags : -L$(JAVA_HOME)/lib/amd64/server -L$(JAVA_HOME)/lib/amd64 -L$(JAVA_HOME)/../lib/amd64 -L/usr/java/packages/lib/amd64 -L/usr/lib/x86_64-linux-gnu/jni -L/lib/x86_64-linux-gnu -L/usr/lib/x86_64-linux-gnu -L/usr/lib/jni -L/lib -L/usr/lib -ljvm JNI cpp flags: -I$(JAVA_HOME)/../include System info: jlaing@xenon:~$ R --version R version 2.15.1 (2012-06-22) -- Roasted Marshmallows Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: x86_64-pc-linux-gnu (64-bit) jlaing@xenon:~$ r --version r ('littler') version 0.1.5 svn revision 185 as of 2011-09-17 09:35:56 built at 15:30:55 on Sep 17 2011 using GNU R Version 2.13.1 (2011-07-08) Copyright (C) 2006 - 2011 Jeffrey Horner and Dirk Eddelbuettel Thanks, John __ 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] littler and rJava
Hi Dirk, Thanks for the quick reply. Setting LD_LIBRARY_PATH does the trick, so I can get by with that in my environment. I would be happy to look into potential improvements. The ./configure may work, but I installed littler through the debian package and thus bypassed manual configuration. I'll look into that too; at the moment autoconf is complaining. Thanks again, John On Mon, Aug 27, 2012 at 9:50 AM, Dirk Eddelbuettel e...@debian.org wrote: John, I see this: edd@max:~$ r -e'require(rJava)' Loading required package: rJava Loading required package: methods Error : .onLoad failed in loadNamespace() for 'rJava', details: call: dyn.load(file, DLLpath = DLLpath, ...) error: unable to load shared object '/usr/lib/R/site-library/rJava/libs/rJava.so': libjvm.so: cannot open shared object file: No such file or directory but also edd@max:~$ locate libjvm.so /usr/lib/jvm/java-6-openjdk-amd64/jre/lib/amd64/cacao/libjvm.so /usr/lib/jvm/java-6-openjdk-amd64/jre/lib/amd64/server/libjvm.so edd@max:~$ LD_LIBRARY_PATH=/usr/lib/jvm/java-6-openjdk-amd64/jre/lib/amd64/server r -e'require(rJava)' Loading required package: rJava Loading required package: methods edd@max:~$ Java is a bit of a moving target. We did add edd@max:~/svn/littler$ ./configure --help|grep java --with-java-libsLink littler to R's java libraries edd@max:~/svn/littler$ a while back but that may not be sufficient. Would you have time to poke around at your end how we could make this better (presuming that you want something more solid than the LD_LIBRARY_PATH adjustment you could also do on your system-side). Dirk -- Dirk Eddelbuettel | e...@debian.org | http://dirk.eddelbuettel.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.
Re: [R] Problem to establish Bloomberg connection / Package RBloomberg / function blpConnect()
Alexander, I agree, this feels like a java version issue. You could start by telling us what version of Java you're running: open a command prompt and type java -verision, and reply with the output. I think any version 1.5 and up should work, but let's see what you have. -John On Mon, Jul 9, 2012 at 4:20 AM, Alexander Erbse a...@alpha-centauri.com wrote: Dear All, when I try to call blpConnect() in order to open a connection to the Bloomberg on my machine, I receive following error message: R version 2.15.1 (2012-06-22) rJava Version 0.9-3 RBloomberg Version 0.4-150 Java environment initialized successfully. Looking for most recent blpapi3.jar file... Adding C:\blp\API\APIv3\JavaAPI\v3.4.8.1\lib\blpapi3.jar to Java classpath Fehler in .jnew(org/findata/blpwrapper/Connection, java.log.level) : java.lang.UnsupportedClassVersionError: Bad version number in .class file It looks there is any problem with the installed java version. Has anyone an idea how to solve that problem? Regards, Alexander Erbse [[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] Problem to establish Bloomberg connection / Package RBloomberg / function blpConnect()
OK. Are you running 32 bit or 64 bit R? And 32 bit or 64 bit Java? This can help shed light on the settings for the JVM being accessed by R: require(rJava) .jinit() jvm - .jnew(java.lang.System) jvm.props - jvm$getProperties()$toString() jvm.props - strsplit(gsub(\\{(.*)}, \\1, jvm.props), , )[[1]] -John On Mon, Jul 9, 2012 at 8:23 AM, Alexander Erbse a...@alpha-centauri.com wrote: John, thanks for your quick response. Here is what you requested: java version 1.7.0_05 Java(TM) SE Runtime Environment (build 1.7.0_05-b05) Java HotSpot(TM) Client VM (build 23.1-b03, mixed mode, sharing) Thanks, Alex -Ursprüngliche Nachricht- Von: John Laing [mailto:john.la...@gmail.com] Gesendet: Montag, 9. Juli 2012 13:14 An: Alexander Erbse Cc: r-help@r-project.org Betreff: Re: [R] Problem to establish Bloomberg connection / Package RBloomberg / function blpConnect() Alexander, I agree, this feels like a java version issue. You could start by telling us what version of Java you're running: open a command prompt and type java -verision, and reply with the output. I think any version 1.5 and up should work, but let's see what you have. -John On Mon, Jul 9, 2012 at 4:20 AM, Alexander Erbse a...@alpha-centauri.com wrote: Dear All, when I try to call blpConnect() in order to open a connection to the Bloomberg on my machine, I receive following error message: R version 2.15.1 (2012-06-22) rJava Version 0.9-3 RBloomberg Version 0.4-150 Java environment initialized successfully. Looking for most recent blpapi3.jar file... Adding C:\blp\API\APIv3\JavaAPI\v3.4.8.1\lib\blpapi3.jar to Java classpath Fehler in .jnew(org/findata/blpwrapper/Connection, java.log.level) : java.lang.UnsupportedClassVersionError: Bad version number in .class file It looks there is any problem with the installed java version. Has anyone an idea how to solve that problem? Regards, Alexander Erbse [[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] What is the most cost effective hardware for R?
For 200,000 analyses at 1.5 seconds each, you're looking at ~83 hours of computing time. You can buy time from Amazon at roughly $0.08 / core / hour, so it would cost about $7 to run your analyses in the cloud. Assuming complete parallelization you could fire up as many machines as you need to get the work done in as little time as you want, with the same fixed cost. I think that's a pretty compelling argument, compared to the hassles of buying and maintaining hardware, power supply, air conditioning, etc. John On Tue, May 8, 2012 at 1:12 PM, Hugh Morgan h.mor...@har.mrc.ac.uk wrote: On 05/08/2012 06:02 PM, Rich Shepard wrote: On Tue, 8 May 2012, Hugh Morgan wrote: Perhaps I have confused the issue. When I initially said data points I meant one stand alone analysis, not one piece of data. Each analysis point takes 1.5 seconds. I have not implemented running this over the whole dataset yet, but I would expect it to take about 5 to 10 hours. This is just about acceptable, but it would be better if this was quicker. As I say, the exact analysis method has not yet been determined, and if that was significantly more computationally intensive then that could be an issue. If I had to do what you write above, I would separate the data into chunks; one for each core/CPU in my system. Then I would invoke R to run on each core/CPU and have that instance process one data set. With sufficient memory for each core/CPU the processing will occur in parallel and cut the overall time by the number of instances running. You might want to turn up the air conditioning around the system 'cause that CPU is going to be working hard. That is roughly how I am working on getting it running currently, and the 5 hour estimate assumes that is perfectly parallelisable. We have a server room with a reasonable air con. I have only just thought about adding the extra cooling to the total cost, but I suspect that that will come from a different budget so may not matter so much. I shall include it in the quote until told to do otherwise. Rich __ 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. This email may have a PROTECTIVE MARKING, for an explanation please see: http://www.mrc.ac.uk/About/Informationandstandards/Documentmarking/index.htm __ 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] Bloomberg API functions BAddPeriods Binterpol Bcountperiods in RBloomberg
Hello, These functions are not available in RBloomberg. As far as I can tell, Bloomberg does not expose these functions in the general API; they are specific to the Excel version. R has other mechanisms for performing date arithmetic, both in the Date class and the POSIXct/POSIXlt classes. This won't help with calendar conventions, but it's a start. Also, R's approx function can be used for interpolation. HTH, John On Thu, Apr 5, 2012 at 3:42 AM, arvanitis.christos arvaniti...@piraeusbank.gr wrote: Hi to all, Is there a way to use the API bloomberg functions BAddPeriods Binterpol Bcountperiods in RBloomberg? tnks -- View this message in context: http://r.789695.n4.nabble.com/Bloomberg-API-functions-BAddPeriods-Binterpol-Bcountperiods-in-RBloomberg-tp4534163p4534163.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. __ 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] API Baddperiods in RBloomberg
The binaries for RBloomberg are hosted on findata.org. The package is only useful in combination with a Bloomberg terminal, but users who have access to one should not be deterred by its absence from CRAN. John On Thu, Apr 5, 2012 at 12:18 PM, Prof Brian Ripley rip...@stats.ox.ac.uk wrote: On 05/04/2012 08:54, arvanitis.christos wrote: Hi to all, Do you know how I can use Baddperiods from RBloomberg Most of us cannot even use 'RBloomberg': it has been removed at the request of Bloomberg's lawyers. -- Brian D. Ripley, rip...@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595 __ 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.