r

Best device for SVG graphics in R?

Hi all, I'd like to export SVG graphics from R. There appear to be two alternatives: RSvgDevice and Cairo. Can anyone comment on these packages? Is either the default, or clearly better than the other? Many thanks, ...

Merge Command in R

Hello, I have been playing around with the merge command in R and am trying to figure out how to use the SUFFIX parameter. The online documentation does not do a very good job at explaining it. What I'd like to do is import some csv files: data1<-read.csv("fileA", header=T) data2<-read.csv("fileB", header=T) And then use the merge c...

How to print R variables in middle of String

Hi All, I am trying to print out a line that contains a mixture of a String and a variable. Here is the R code at present: cat("<set name=\",df$timeStamp,\" value=\",df$Price,\" ></set>\n") Here is what it prints out when run: <set name=",df$timeStamp," value=",df$Price," ></set> I would like it to have the value of df$timeStamp an...

How to get started with creating an R application that is based on / uses JGR ?

Dear all, can anyone point me to a good start for developing a JGR dependable R application? Roughly speaking I want to do something that enhances the JGR menu by some options just like Deducer (btw now available with ggplot2!!) does (of course I want to do it in a much much simpler way). Basically the application is a GUI for renderi...

How to create contigency tables (crosstabs) in R for a subset of columns with categorical data?

I have a table whose header looks like this (I've simplified it): id, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10 where each row, except for id, is a categorical variable. Let's name the categories A, B, C, D, E. I would like to create a contingency table for some of the columns, such as below (for brevity, I have not put sample numbers ...

Getting rid of the "hidden column" in data frames of R

I have a data frame that I am outputting to MS Word. Lets say I'm trying to output the data frame mtcars, then using the R2wd package, I get: #install.packages("R2wd") require(R2wd) wdGet() wdTable(mtcars) '>ncol(mtcars) 11 however a count shows that there are actually 12 columns. R doesn't include the model of car. I have a...

Wrap text in dataframe in R- or in output cell to Word

I am working in R, trying to export a dataframe to MS Word. I am using R2wd and would like a dataframe to export to MSWORD, and wrap a long string of text within a cell. Is that even possible? Bare minimum at least pass a command from R to set the height of each row to fit the contents of the cell... I don't see any demos or document...

writing the outcome of a nested loop to a vector object in R

Dear Stackers, I have the following data read into R as a data frame named "data_old": yes year month 1 15 2004 5 2 9 2005 6 3 15 2006 3 4 12 2004 5 5 14 2005 1 6 15 2006 7 . . ... . . . ... . I have written a small loop which goes through the data and sums up the yes variable for each ...

R + ggplot: update problems with geom_tile

I've recently installed the latest version of ggplot, by downloading the source from CRAN and then running install.packages("/path/to/ggplot2_0.8.8.tar.gz", repos = NULL, type="source") Now, running the first example from geom_tile()'s documentation on the ggplot2 website: library('ggplot2') pp <- function (n,r=4) { x <- seq(-r...

Where can I find a hosting service with R?

Are there any traditional (cheap, shared) web hosting services that have R on the server? UPDATE: I went with Dreamhost on this one. I first tried to build R on a shared server, but I needed their support staff installed some packages (ex gfortran). After some struggles, I was able to get R built from source with the exception of the x1...

Newman's modularity clustering for graphs

Hello, I am interested in running Newman's modularity clustering algorithm on a large graph. If you can point me to a library (or R package, etc) that implements it I would be most grateful. best ~lara ...

How to Stop proc.time being run when exiting R using quit()

Hi All, I am running a Batch file on Windows that runs an Rscript that creates two XML files. However at the end of the second XML file the following gets appended onto it: > proc.time() user system elapsed 4.97 0.62 7.78 Is there a way of stopping this from happening? Regards, Anthony. ...

passing R function arguments in rpy

I have the following two lines of code that both run fine in both R and Python (via Rpy): [R] rcut = cut(vector, brks) [Python] rcut = r.cut(vector, brks) However, if I want to add the argument of include.lowest=TRUE, it runs as expected in R: [R] rcut = cut(vector, brks, include.lowest=TRUE) But it doesn't work in Rpy: [Python] r...

Adding arbitrary labels to each group in a grouped scatterplot in ggplot2

I have a list of matrices I wish to plot. Each element in the list ultimately represents a facet to be plotted. Each matrix element has dimensions Row * Col, where all values in a row are grouped and plotted as a scatterplot (i.e. X-axis is categorical for the row names, Y-axis is the value, Col. values per row). Additionally, I would...

Vector operations by time intervals , in R ??, aggregate

Hello I have a time series (zoo with index type chron) and I need to calculate the cummax(mydata)-mydata on every day separately. Getting a zoo timeseries again. I've tried this aggregate(mydata, as.date, cummax) but aggregate can only produce a single scalar result for each subset instead of a vector. I've read that maybe with tapply...

Regex pattern match in a character

Hi all, I am new to R so I apologize if this is easy and straight forward. I have successfully read a web page into a character vector. I want to strip this string down to a smaller segment so I can extract some data. So far, so easy. The problem is that I am new to regex and R, so this has been pretty hard for me. I simply want to...

sendmailR: Submit encoded message to local SMTP server

I need your help in order to send email message that includes text in Greek, from within R, using the function sendmail {sendmailR}. I tried using the function iconv, like that but it didn't work subject <- iconv("text in greek", to = "CP1253") sendmail(from, to, subject, msg, control=list(smtpServer="blabla")) The mail arrives immed...

Plotting a box within filled.contour plots in R?

Hi, I'm trying to plot a box within a filled.contour plot, but unfortunately, when I plot the lines() after the filled.contour plot is created, the figure is shifted to the right because the scale forces the image to the left, but the box stays at the same coordinates. Here's what my code looks like: dev.new(width=6,height=7) mypredict...

Adding an exponential geom_smooth in ggplot2 / R

I am trying to produce some example graphics using ggplot2, and one of the examples I picked was the birthday problem, here using code 'borrowed' from a Revolution computing presentation at Oscon. birthday<-function(n){ ntests<-1000 pop<-1:365 anydup<-function(i){ any(duplicated(sample(pop,n,replace=TRUE))) }...

Sorted quantile mean via Rpy

The real goal here is to find the quantile means (or sums, or median, etc.) in Python. Since I'm not a power user of Python but have used R for a while, my chosen route is via Rpy. However, I ran into the problem that the returned list of means are not correspondent to the order of the quantiles. In particular, I have the followings in R...