Downloading Package "Cart" in R - r

Does anybody know where I can download the R package "cart" that can help create Gastner's
"Mapping with Diffusion-based Cartograms" ? I tried a install.package on R and says it's not available
for R 2.15. There is a page on R-forge about it but it doesn't explain how to download the package.
Thanks.

Way late to the game, but from what I can tell there's not much happening for the cart package; my recent efforts with cartogramming in R have pushed me towards two alternatives: Rcartogram within R (available from the GitHub repository) and ScapeToad, a program written in JS.
Advantage of the former is that you don't have to leave R (better for long-term project management), however it's a bit arcane to use (requires converting your shapefile to a density grid & then figuring out how to use an interpolation method, etc.).
Advantage of the latter is that it's got a very simple point-and-click GUI--add shapefile, create cartogram wizard, export shapefile, voila.
Both are based on the Gastner-Newman diffusion-based algorithm.

If you check the build page you'll see that at the moment the package fails to build. I thought it might be something minor but I've put in a little bit of work so far and it's still failing to build on my machine.
You might want to email the authors and ask them. You could also try their forum but it looks like it hasn't seen much activity lately.

Related

Using ConsRank in R Studio

Installed both R studio and ConsRank package but i have little R and Math knowledge.
I need to understand how to calculate and reach the result of the formula in attached files.
To solve this problem, correlation coefficient τx used which is intruduced by Emond and Mason (2002)
I tried to use ConsRank functions but my R knowledge was not enough.
FormulaFormula
MatrixMatrix
ResultResult
The first step is to install and load the package ConsRank using the following codes:
install.packages('ConsRank', dependencies=T)
library(ConsRank)
If you successfully load the package, you are good to go. The next step is to read the documentation of the package (Click Here) in which you will learn about what functions you will need and there are some different examples that help you understand the input and outputs.
Let me know if you needed any help running your scripts. Good Luck.

Import one function in R package (without importFrom)

I'm writing an R package and I'd like to use one function from another package (plotKML). This external package has so many dependencies that I don't want my users to be required to download etc. If I use importFrom(plotKML, readGPX) in the NAMESPACE file it will load all of plotKML into the namespace and download all dependencies which I don't want.
So the question is: is it appropriate to copy the code for the one function I need (ensuring that all the dependencies in that one function are included)? If so what is appropriate for the attribution/documentation -- do I copy the documentation from the original?
There is a great discussion of this issue in this post and the answer by Brian Diggs is very helpful. But he ends with "For your example, you may be better off copying the code for memisc::describe into your package, although that approach has its own problems and caveats" so I'm left with some uncertainty about what the problems are and whether it's appropriate from a attribution perspective.
Questions about the appropriate attribution would probably be best resolved by contacting the package author directly. As noted in the comments above, that package appears to use GPL-3, which should mean that you can include the function in your package but your package must then also be GPL-3 licensed. (As always, probably no one here is a lawyer so that's on you to check...)
The primary downside to copying just the function you need is that then you are responsible for maintaining it. This probably also means maintaining it in a way that keeps it in sync with the original version from plotKML. Depending on the package, surrounding code and how often it is updated that could be fairly simple or it could be horrible.

Stealing methods and data from other R packages

I am currently developing an R package that make use of different datasets from other R packages. As a result, my package has a large number of dependencies, and the user is required to install various unrelated packages in order for my package to work.
I would prefer to copy these datasets to my own package and give proper credit in the documentation, but is there a problem with that?
And what about simple functions from other packages? For example, I need the Matern function from the fields package, and it seems much simpler to just copy that function to my own package instead of having a dependency on a whole package full of unrelated functionality.
Why not just ask the authors/maintainers of those packages for their permission or thoughts on the matter? They may know something that the rest of us don't about how the functions are implemented and how easy they are to copy.
Two different people asked me if they could include a function from my package in theirs, they explained why they wanted to and what they were doing and I agreed that having the user install my whole package for just the 1 function would be overkill and gave them my blessing (and the original source code) to include the functions in their packages (technically due to the license they did not need my permission). Now when I update either of the functions, I also send the updated source code to those 2 authors so that they can keep their copy up to date if they want to.

Using Protovis with R

As question, I have satisfied with what R and ggplot2 can do for static graph, but what about interactive graphs? How combine R and Protovis to make the graphs?
There is somethings called rwebvis but seems it is no longer active.
Any suggestion? Thanks.
Well, first you need a web server. Ooh, R has one of those now. Then you need some way of generating output on the web from R code - ooh, R has one of those too:
http://jeffreybreen.wordpress.com/2011/04/25/4-lines-of-r-to-get-you-started-using-the-rook-web-server-interface/
So you can then write R server pages that return JSON-encoded data that you can feed to Protovis - or if you want to get right up to date, to D3, which is Protovis++ and made of win.
Iplots is a fairly useful package that allows interactive graphing ( by this I mean selection linking between graphs, color linking, etc). It has some limitations and is not really made for producing plots as much as exploring data trends.
Acinonyx also was recently updated which is supposed to be an updated version of iplots, but from what I can tell it still has some work to do.
Not familiar with protovis or rwebvis.
There is a package from google called googlevis that enables some interactivity. This produces plots that are embeddable online. If you like protovis, the same author has another library called D3.
For running R on a webserver, I have been experimenting with RApache, which enables you to link your R installation to an apache server.
If the interactivity does not to be online, RStudio have a package called manipulate which may also be of interest.

Namespaces in R packages

How do people learn about giving an R package a namespace? I find the documention in "R Extensions" fine, but I don't really get what is happening when a variable is imported or exported - I need a dummy's guide to these directives.
How do you decide what is exported? Is it just everything that really shouldn't required the pkg:::var syntax? What about imports?
Do imports make it easier to ensure that your use of other package functions doesn't get confused when function names overlap?
Are there special considerations for S4 classes?
Packages that I'm familiar with that use namespaces such as sp and rgdal are quite complicated - are there simple examples that could make things clearer?
I have a start on an answer on the devtools wiki: https://r-pkgs.org/Metadata.html
Few years later here....
I consolidated findings from Chambers, other StackOverflow posts, and lots of tinkering in R:
https://blog.thatbuthow.com/how-r-searches-and-finds-stuff/
This is less about implementing NAMESPACE/IMPORTS/DEPENDS and more about the purpose of these structures. Answers some of your questions.
The clearest explanation I've read is in John Chambers' Software for Data Analysis: Programming with R, page 103. I don't know of any free online explanations that are better than what you've already found in the R Extensions manual.
You could also pick an easy, small package and follow it.
I semi-randomly looked at digest which is one of my smaller packages. I loads a (small) dynamic library and exports one symbol, the digest() function. Here is the content of the NAMESPACE file:
## package has dynamic library
useDynLib(digest)
## and one and only one core function
export(digest)
Have a look at the rest of the source files and maybe try to read Writing R Extensions alongside looking at the example, and do some experiments.
http://www.stat.uiowa.edu/~luke/R/namespaces/morenames.pdf

Resources