I'm using R for data analysis, and I'm sharing some data with collaborators via Google docs. Is there a simple interface that I can use to access a R data.frame object to and from a Google Docs spreadsheet? If not, is there a similar API in other languages?
There are two packages:
RGoogleDocs on Omegahat: the package allows you to get a list of the documents and details about each of them, download the contents of a document, remove a document, and upload a document, even binary files.
RGoogleData on RForge: provides R access to Google services through the Google supported Java API. Currently the R interface only supports Google Docs and Spreadsheets.
As of 2015, there is now the googlesheets package. It is the best option out there for analyzing and editing Google Sheets data in R. Not only can it pull data from Google Sheets, but you can edit the data in Google Sheets, create new sheets, etc.
The GitHub link above has a readme with usage details; there's also a vignette for getting started, or you can find the official documentation on CRAN.
This may partially answer the question, or help others who want to begin by only downloading FROM public google spreadsheets: http://blog.revolutionanalytics.com/2009/09/how-to-use-a-google-spreadsheet-as-data-in-r.html#
I had a problem with certificates, and instead of figuring that out, I use the option ssl.verifypeer=FALSE. E.g.:
getURL("https://<googledocs URL for sharing CSV>, ssl.verifypeer=FALSE)
I put up a Github project to demonstrate how to use RGoogleDocs to read from a Google Spreadsheet. I have not yet been able to write to cells, but the read path works great.
Check out the README at https://github.com/hammer/google-spreadsheets-to-r-dataframe
I just wrote another package to download Google Docs spreadsheets. Its much simpler than the alternatives, since it just requires the URL (and that 'share by link' is enabled).
Try it:
install.packages('gsheet')
library(gsheet)
gsheet2tbl('docs.google.com/spreadsheets/d/1I9mJsS5QnXF2TNNntTy-HrcdHmIF9wJ8ONYvEJTXSNo')
More detail is here: https://github.com/maxconway/gsheet
Since R itself is relatively limited when it comes to execution flow control, i suggest using an api to an high-level programming language provided by google: link text.
There you can pick whichever you are most familiar with.
I for one always use python templates to give R a little more flexibility, so that would be a good combination.
For the task of exporting data from R to google docs, the first thing that comes to my mind would be to save it to csv, then parse and talk to g/docs with one of the given languages.
Related
I want to create a product/project documentation in R that is going to be reviewed and discussed by a group of reviews. There are plenty of examples of how to create book-like documents using Rmarkdown (e.g. https://bookdown.org/) or interactive data visualizations using R-shiny. However, I could not find any solution for user comments similar to LibreOffice Writer, MS Word, or Google Docs. I could also imagine having a split-pane where one side is dedicated to the content presentation (e.g. text, graphs, code), while the other side is left for comments.
I am aware that such a solution requires a server-side solution for storing comments.
Any hints on existing solutions, workarounds, and implementations are welcome.
If I correctly understood, your question isn't very R specific. R is just code, R files are just text and they don't allow comments (beside the raw hashtag comments) and reviews. Your question is more about version control environments, that allow reviews on code stuff. The most used version control system is git, and git has an integrated panel in RStudio.
Git allows you to split your developpements in branches, which are the different ideas you and your coworkers can work on independentely. Once an idea is finalised, after some consecutive modifications known as commits, it is to be asked for merge in the "main branch". It is a "pull request".
That is where the different platform using git, like GitHub or GitLab, allow some review systems. Basically, when a branch is done, you ask "is that ok ?". Your reviewer can see the changes, can try you things, and tell if that is actually ok.
The other advantage of these is the continuous integration, that is : elaborating tests (in R with testthat) that will be tested on some events merge, like "on each merge to master". It is meant to ensure that the software is going forward : if a merge breaks some earlier test, you'll know it.
For beginners, in order to avoid being lost in bash commands, GitHub Desktop is a fine GUI above Git.
Note : You can also rely on the package usethis which has a few helper functions like use_git, use_gitlab_ci, use_github_action... It's not specific to reviews and comments but to the gitlab and github integration
I am setting up a database of certain events that have occurred in the past, and need to search the internet for a number of terms to retrieve as many pages as possible that contain terms related to the happenings i want to document.
First I looked into achieving this using Googles "Custom Search API", after reading this question:
Need to access Google Custom search api through R
I did manage to get a JSON of search results through the browser, but not through R, so I moved on.
When I saw that the Custom Search API was using OpenSearch, and found the rOpenSearch package for R, I wanted to try going down this path:
http://terradue.github.io/rOpenSearch/
After reading through the documentation, there was only provided examples of searching sites that provide opensearch descriptions. As I need to search as many websites as possible, it seems like I would need an opensearch description for a search engine like Google. But I can't seem to find that anywhere.
Is there any way to search the internet via. R using OpenSearch, and collecting the results in a data table?
If you know of a better solution to my problem, I'd appreciate if you could point me in another direction.
If I read well, you are looking for something called Web Scraping via R.
<See me!>
I have a ton of saved places that appear on my Google Maps - but there is no way to manage, filter or search them. Is there a way to access these locations by API?
I scanned the maps api and can't find any reference. Is there another Google API that makes this available?
There do have a REST API can retrieve the saved places.
http://www.google.com/bookmarks/?output=xml
Visit this link to get more information.
https://www.google.com/bookmarks/
There are also api like:
https://www.google.com/bookmarks/find?q=conf&output=xml&num=10000
https://www.google.com/bookmarks/lookup?
But seems like they have been deprecated and most of document are not available anymore. Use them as you own risk.
Currently the list of saved places in My Maps is not available via an API. There is a feature request tracking this you can use to follow along # https://code.google.com/p/gmaps-api-issues/issues/detail?id=2953.
2022: I created a gist for parsing saved places from a shared list via python. It is really unstable because its a quick&dirty solution but maybe it will help someone: https://gist.github.com/ByteSizedMarius/8c9df821ebb69b07f2d82de01e68387d
Edit: The above answer did not yet take pagination into consideration. Please see my answer here.
We are currently working with the Gracenote Music API and are wondering if there is a full list of generes and mappings between the different hierarchies of genres. Ideally, we'd love a dump of those tables in the backend Gracenote system. If .csv's, text files, or even XML are easier to provide, we will figure out a way to import that data in our system.
If a full mapping isn't available, a list of top level genres would be very helpful.
I'm afraid there is no way to iterate the list of genres via the Web API. Most of the client SDKs have this capability.
It turns out that there are at least three sources for example code in the GNSDK:
Properly maintained samples in the "samples" directory. This will compile into full applications with minimal effort (once you've settled on a makefile solution for your platform, as a complete Automake setup is not yet part of the package).
samples/code_snippets - These are useful to look at, but do not necessarily build into full apps, and may not be completely up to date with the SDK.
Code linked from the documentation. This is a problem if you downloaded the SDK as an archive and the documentation as a PDF, as the links will resolve as relative file links, not HTTP links, and you won't have the files. You need to look at the HTML version of the documentation on the server to find these files. However, they are apparently outdated and will not build without some (relatively minor rework). This can be done using the primary samples as a guide.
So, all of that said, what you want to look at in the GNSDK Developer's Guide is "Advanced Topics : Using Lists". You will want to read that entire section, then find and work with the sample application referenced on page 93.
To get the list of genres (or moods, or eras) you need to make a call to the "fieldvalues" API, you can see how to do it here:
https://developer.gracenote.com/rhythm-api#attribute-station
This call will give you the list of supported genres:
https://cXXXXXXX.web.cddbp.net/webapi/json/1.0/radio/fieldvalues?fieldname=RADIOGENRE&client=CLIENT_ID&user=USER_ID
You can then use the returned ID's with pygn.createRadio()
What's the best library to use to generate RSS for a webserver written in Common Lisp?
Most anything will probably do. Personally, I've been using xml-emitter for my blog's Atom feed, which has worked out well so far.
Just choose whichever XML generation library you like and hack away, I'd say. As others have remarked, RSS is simple; it's little work to generate it manually.
That said, I recommend not generating plain strings directly. Having to deal with quoting data is more of a hassle than installing an XML library, and it's also insecure in case your feed contains data submitted by visitors of your website.
xml-emitter says it has an RSS 2.0 emitter built in.
CL-WHO can generate XML pretty easily.
I am not aware of any specific RSS library. But the format is fairly simple so any library that can write xml will do at that level.
You could have e.g. a look at the nuclblog (http://cyrusharmon.org/projects?project=nuclblog) project as that has the capability to generate an RSS feed for the blog entries it maintains.
cl-rss-gen is a tiny library (LGPL, depends on CL-WHO) that does some boilerplate work for you (supports generating RSS entries directly from CLOS class instances by specifying which slot maps to which attribute).
Take a look at the code before using it, it may give you the idea how it's working and whether you need it or not (as other posters said, you can generate RSS yourself with CL-WHO or any XML generation library).
Oh, and sorry for resurrecting a four years old thread, but if anyone searches for similar library, he/she will find the answer here.