It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I would like to generate an interactive plot with R, for example an xyplot that shows information of the data points on mouseover, and I've read about D3. I would like to be able to write R code to generate the D3 html pages automatically. Is there any R package able to do that?
I've seen there is a r2d3 package on github but I am not sure how far that project is. Any ideas?
Looks to be fairly early in its development: https://github.com/hadley/r2d3. Hadley generally makes announcements when things are ready to test and then puts his packages on CRAN when they are ready for prime-time. (There's also confusion in that some versions of D3 on Github are named r2d3 when they have nothing to do with R): https://www.google.com/url?q=https://github.com/mhemesath/r2d3&sa=U&ei=Ig-YULraMueimQWxhYHgCA&ved=0CAwQFjAC&client=internal-uds-cse&usg=AFQjCNGe9p5iKH6deoHDpd2yKHJds8Qdow
Related
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
everyone, I am not familiar with ggplot2. Now I have questions on it. Here are the codes to produce one plot
data <- data.frame(age=sample(c("25-29","30-34"),100,rep=TRUE),ratio=rnorm(100,mean=1,sd=0.3))
library(ggplot2)
qplot(ratio, data=data, geom="bar", fill=age, binwidth=0.1)
Here are my questions.
(1) How to change the color of histogram?
(2) How to put the legend in the panel?
(3) How to change the background color?
Thanks very much in advance!
Have a look at scale_color_manual, the examples should be sufficient. The general structure of tweaking any scale in ggplot2 is to use the appropriate scale function: scale_{aes_name}_{scale_type}, where aes_name can be color, x, or any other aeshetic, and where scale_type can be continuous, discrete, manual, etc.
Googling for ggplot2 legend position led me to this link. Your answer is in there.
Have a look at ?theme, in particular panel.background. The examples there include an example of exactly what you need.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
I'm using R for the first time to learn how to write classification algorithms. I'm mainly learning from the O'reilly book Machine Learning for Hackers.
There's tons of info in R, R documentation, ebooks, and my book about writing functions. However, there are snippets of code in the book that use the word function in a way that does not seem to conform to my understanding of the use of function. For example:
all.spam <- sapply(spam.docs, function(p) get.msg(paste(spam.path,p,sep="")))
where get.msg is a user defined function, sapply is from base R, and p is not defined anywhere in their code. There's no explanation in the book and I also tried searching and asking other R users in my company to no avail.
Any insight? Thanks in advance. By the way, in RStudio the word function is bright blue when used in this way.
In R, you define anonymous and named functions using the same syntax, so your example:
all.spam <- sapply(spam.docs, function(p) get.msg(paste(spam.path,p,sep="")))
Is equivalent to:
my_spam_func <- function(p) {
get.msg(paste(spam.path, p, sep=""))
}
all.spam2 <- sapply(spam.docs, my_spam_func)
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I have a .csv file in my workstation. How can I open that file in R and do statistical calculation?
You would use the read.csv function; for example:
dat = read.csv("spam.csv", header = TRUE)
You can also reference this tutorial for more details.
Note: make sure the .csv file to read is in your working directory (using getwd()) or specify the right path to file. If you want, you can set the current directory using setwd.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
By following this thread
I have created a radar chart. Can anyone suggest me how to add a legend to this graph?
Here's a generic legend to get you started. You can alter it to suit your particular needs:
legend(-2,0,
legend=c("V1","V2"),
pch=c(15,16),
col=c("blue","red"),
lty=c(1,2))
The first two arguments are the location of the legend, in terms of the plot's (x,y) coordinates. Check the help for more details on the various arguments to the legend function.
I think you're getting negative votes because you essentially asked others to do your work for you. In the future, try out a few things first to see if you can get at least a partial answer. Then, in your question, explain what you've tried and what, specifically, you're trying to accomplish.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
i assume that we have 2 labeled graphs G and T and the algorithm determine if G a subgraph of T and the corresponding vertices in the main graphT and the subgraph G should have same label
That problem is called "subgraph isomorphism" and it is NP-complete (and so likely to be hard). Do you need a general solution for this, or just for a particular graph G? The second case is much easier. There is some general information about algorithms here. There is a version of one of the algorithms (actually, for a more general problem) in the Boost Graph Library (see documentation here).
A general answer for a general question: the problem you want to solve is known as 'subgraph isomorphism.' Have a look here for further references: http://en.wikipedia.org/wiki/Subgraph_isomorphism_problem .