R Quandl Error, No Daily - r

Quandl("CHRIS/CME_CL1", trim_start=Sys.Date()-15, trim_end=Sys.Date()-10, collapse="daily")
Error in match.arg(collapse) :
'arg' should be one of “”, “weekly”, “monthly”, “quarterly”, “annual”
Any ideas why that wont work? I copied straight from website too..

I'm the maintainer.
Initially when I created the package I saw no need to support daily since by default the data returned is the most granular, which in our case is daily. However I have seen some confusion arising lately and it won't hurt to accept it. I will accept "daily" as a parameter on the next release.
This should work right now
Quandl("CHRIS/CME_CL1", trim_start=Sys.Date()-15, trim_end=Sys.Date()-10)

Related

I cannot obtain scores for a metaMDS object in RStudio (package: vegan)

I'm using vegan 2.6.4 in RStudio, and have had an unusual error message pop up when I run the the following:
nmds11 = metaMDS(m_com11, distance = "bray")
data.scores11 = as.data.frame(scores(nmds11)$sites)
Error in UseMethod("scores") :
no applicable method for 'scores' applied to an object of class "c('metaMDS', 'monoMDS')
I can safely say this has never happened to me, and I was using the exact same code on a different dataset 5 minutes ago with no issues. I have also previously run this same script on at least a dozen other matrices with no errors.
I have tried calling scores.metaMDS as suggested when looking up the scores function (to help specify what type of object I'm trying to get scores from), but that function apparently does not exist. I've also tried running some old scripts that always worked in the past, with the same unfortunate results.
Any idea what I can do to address this?
Try using vegan::scores(); it could be that some other package you have loaded also has a scores() generic that is overwriting vegan::scores(). You can also try the much more specific vegan:::scores.metaMDS() if the whole S3 system has gotten clobbered.
Beyond that, restart R (in RStudio, find the Restart R option in the menus) so you get a clean session and try running your code again.
I I tried vegan:::scores.metaMDS() without restarting RStudio and it works ! Thanks !!!

Visualize tree structure of HTTP GET requests in server log files using R 3.2.3

I'm relatively new to R, and I've volunteered to try to use it to determine which files on an old media server are still being used, and which aren't. I have access to the server logs, and specifically the cs-uri-stem column. Here's what I get when I type head(uridata):
1: /favicon.ico
2: /courses/filipino/Kuwentong_Pambata/Isinaayos_ni_Leslie_Joy_Cruz.html
3: /courses/filipino/Kuwentong_Pambata/Isinaayos_ni_Leslie_Joy_Cruz_files/Isinaayos_ni_Leslie_Joy_Cruz.css
4: /courses/filipino/Kuwentong_Pambata/Isinaayos_ni_Leslie_Joy_Cruz_files/Isinaayos_ni_Leslie_Joy_CruzMoz.css
5: /courses/filipino/Kuwentong_Pambata/Isinaayos_ni_Leslie_Joy_Cruz_files/shapeimage_1.jpg
6: /courses/filipino/Kuwentong_Pambata/Isinaayos_ni_Leslie_Joy_Cruz_files/WidgetCommon.js
Obviously, the samples in this case are all coming from one set of folders, but in fact, there are thousands of different folders and languages, all of which have their own websites. I'm interested in being able to visualize this as a tree, to see which folders/languages are still getting usage.
I've looked at the data.tree package for R, which I thought would be ideal. I've tried to follow the guide at https://cran.r-project.org/web/packages/data.tree/vignettes/data.tree.html#trees-in-data.tree, but when I type "as.Node(uridata)", R gives me the error message "Error in myrow[[pathName]] : subscript out of bounds". I've searched online for that error, and understand that it occurs when you try to call a subscript that isn't in the original data set, but I don't understand why it is happening here.
Can anyone give me some guidance as to why I'm running into this problem, or how I can solve it? I'm running R 3.2.3 on OS 10.11.3, using RStudio.
Never mind, I figured it out. I didn't read the data.tree guide closely enough the first time. In order to use as.Node() to transform my HTML paths into a tree, I needed to add a column, $pathString, with that same data using the following command:
uridata$pathString <- paste("..", uridata$cs.uri.stem, sep = "/")
That creates a "pathString" column for the data. Then, as.Node(uridata) works properly.

R - "Browser()" on Error?

I have been using some R libraries to analyze some large data recently, and I find myself frustrated by waiting several hours for the beginning of an analysis, just to get to the end and receive some trivial error, like that I did not install a prerequisite library, or that one of my parameters was wrong. So, then I have to start all over, do the exact same analysis, generate the same variables that it had when it died, and wait a long time. Please note that these are not handled exceptions--they are fatal errors from R.
This is just a thought--and perhaps it is too good to be true, so please at least explain why it wouldn't work--but is there any way to cause R to execute "browser()" in the environment whenever it has a fatal error? For example, say it is executing a script, and encounters "require(notInstalledYet)". Instead of just dying, and losing all the variables in the memory, it would be great if it would give me a browser() at the place it died, so that I could at least save the variables, and at best, fix the problem (e.g. install the library) and try again.
You can change the error option to open a browser on error
options(error=browser)
the default is
options(error=NULL)

RcmdrPluginPackage Paths

My paths and files are as follows ...
E:R/R-2.15.1/library/Rcmdr/
E:R/R-2.15.1/library/RcmdrPlugin.Package/
E:R/R-2.15.1/MyLibrary/RcmdrPlugin.Package.zip
E:R/R-2.15.1/MyLibrary/RcmdrPlugin.Package/
where, in the name RcmdrPlugin.Package, I've used the word 'Package' to represent the name of the actual package being used.
The installation is as described above because (i) I'm not an expert at installing packages, (ii) I couldn't do a direct install from Cran because I wanted to put the package onto a USB stick; and, (iii) at work the Cran server is blocked (sic).
When I start the package from the GUI the Cmdr opens once and quickly closes (I don't know if this is relevant or normal) and opens again. Once open, I can operate the package via the Cmdr interface. It's a very nice package, everything works really well until I want to save the work. Then I get the following error,
Error in obj[i] : object of type 'closure' is not subsettable
I've been in contact with the people who developed (and are still developing) the package and they cannot reproduce the bug.
I strongly suspect that the problem lies in my 'crappy' install and file configuration, rather than with the package.
Can anyone please help me by suggesting how I would undo what I've done and do it properly in view of the constraints list above?
I appreciate that I can use Remove to get rid of the package but I don't want to start tinkering with something without having a greater understanding of what I'm doing.
Lastly, note that is error has been discussed a number of times on this list but not within this particular context.
I've managed to get it to work by following the instructions from here stackoverflow.com/questions/12820189/… where I set repos=NULL after I'd put the package into /MyLibrary/

How can I remove a lock from a linked environment in R?

I tried to run a Bioconductor package (truncateCDF) that modify an environment(hgu133plus2cdf), to remove unwanted probesets, from an affymetrix chip.
Everything went fine, until I got the following message (translated from french):
> assign(cdfname, cdf.env, env=CDF.env)
Error in assign(cdfname, cdf.env, env = CDF.env) :
impossible to change the value of a locked link for 'hgu133plus2cdf'
The assign function is the ultimate function of the code, that save the changes made to the environment dataset CDF.env to the original environment (hgu133plus2cdf), before using it in analyses of affymetrix chip results; so, it is essential.
My question: what is this locked link to the hgu133plus2cdf environment, and how could I bypass it.
The author of this package successfully run its package around 2005; so I suppose it is a feature introduced since then in R (probably not related to Bioconductor, since assign is a basic R function, reason why I ask this question on this forum instead of Biostar).
I tried to read the docs, but I am overwhelmed, when it comes to environments.
Thanks in advance for any help.
I don't think truncateCDF is from a Bioconductor package; it is a at least not current. This sounds like this post and the next two from the same thread from the Bioconductor mailing list. It is a result of a change in R -- packages now have not-easily-modified name spaces, and these are implemented by locking the environment in which name space symbols are defined. Removing probes is not an essential part of a typical microarray work flow. Please ask on the Bioconductor mailing list (no subscription required) if you'd like more help.

Resources