r

suitable languages for a semantic web project

Currently I am thinking and searching for the adequate programming languages for a project (more than one programming language will be used). Questions: Is there a big mistake presented in my list (other than my belief of go as a suitable language)? Any tipps before I start? project: opensource project with semantic web (including rdf/...

After I upgrade my R version, how can I easily reinstall all the packages that were installed in the old version?

Possible Duplicate: Painless way to install a new version of R? In R, packages are not compatible across upgrades, and must be reinstalled. Is there any way to easily install the same set of packages in the new version as what I had installed in the old version? Edit: I can't easily access the old version of R, since I upgrad...

R: number format, writing 1e-5 instead of 0.00001

Hello I've used read.table to read a file that contains numbers such as 0.00001 when I write them back with write.table those numbers appear as 1e-5 How can I keep the old format? thanks ...

R: How to select not continous rows?

Hello How can I select several not continuous rows ? If I wanted to select rows 1 to 7 I'll write mydata[,1:7] But what if I need to select rows 1 to 5 and 10 to 15? ...

R: Plotting a 3D surface from x, y, z

Hello imagine I have a 3 columns matrix x, y, z where z is a function of x and y. I know how to plot a "scatter plot" of these points with plot3d(x,y,z) But if I want a surface instead I must use other commands such as surface3d The problem is that it doesn't accept the same inputs as plot3d it seems to need a matrix with (nº elem...

Time-based averaging (sliding window) of columns in a data.frame

I have a data.frame which has multiple columns. One of the columns is time and is thus non-decreasing. Rest of the columns contain observations recorded at the time given by the time specified in a certain row of the data.frame. I want to select a window of time, say "x" seconds, and calculate the average (or for that matter any functio...

idata.frame: Why error "is.data.frame(df) is not TRUE"?

I'm working with a large data frame called exp (file here) in R. In the interests of performance, it was suggested that I check out the idata.frame() function from plyr. But I think I'm using it wrong. My original call, slow but it works: df.median<-ddply(exp, .(groupname,starttime,fPhase,fCycle), n...

Proj4 reprojection using R

Hi, I am trying to reproject coordinates from WGS84 to MGA Zone 53, a UTM projection based on the GDA94 datum. I get infinity as my result, which is definitely incorrect. I am using R's proj4 package like so: > library(proj4) > df <- data.frame("x" = c(131.1, 131.102, 131.1106, 133.34), "y" = c(-13.23, -13.243, -13.22, -22.66)) > df ...

Theming with Sweave or other LaTeX like PDF Generators that are R friendly.

Is there a way to generate a theme for sweave documents? I have a number of reports that I generate monthly, where I use R to generate the text, tables and images. But now I'm stuck in the rut of copying and pasting this information into MS Publisher placing the text in a themed document that we had a graphic designer make for us. What...

How can I access the name of the function generating an error or warning?

If a warning or error occurs, I would like to print the name of the function generating the error. tryCatch in R allows one to handle errors in a function call, perhaps it is part of the solution? For example, this could be in a context like: handleErr <-function(e) { print("you had an error in function:") print( WHAT CAN I P...

How do a perform a weighted, 2d kernel density estimation in R?

I would like to produce a kernel density estimation in R, and am somewhat bamboozled by all the different packages. I need to be able to: Specify weights Specify bandwidth size Specify bin size How would you go about this? Bonus points for a code snippet. ...

plyr in R very slow during merging

I am using plyr package in R to do the following: pick up a row from table A according to column A and column B find the row from table B having the same value in column A and column B copy column C from table B to table A I have made the progress bar to show the progress, but after it shows to 100% it seems to be still running, as I...

How to select standard deviation within a row? (in SQL - or R :)

Dear all, I wonder if there is a way to select the standard deviation from several integer fields in MySQL within the same row. Obviously, if I use SELECT STDDEV(col1) FROM mytable I just get the standard deviation of that particular column. Let´s assume I have a table like: id,somefield1,somefield2, integerfield1,integerfield2,inte...

R: How to create a vector of functions?

I would like to create a vector of functions using a two agruments function 'func', for instance this one: func = function(number, coefficient) { return(coefficient*number) } here is how I create the vector of functions: vector_of_functions = NULL for (i in 1:4) { vector_of_functions = c(vector_of_functions, function...

Problem with iplots library which prevents JGR to start on macos

I want to install (and run) JGR on my macos to develop R scripts. To do so, I have installed R-2.12.0. (dmg), neccessary libraries for JGR and JGR (ui for R) following these instructions: install.packages(c("rJava","JavaGD","iplots")) install.packages("JGR") Unfortunately I can not load JGR library, because I got an error within iplo...

Export igraph Issues in R

I have generated a few network graphs in igraph. I like to use tkplot, however, after resizing the window manually and changing the layout, my machine freezes up when I try to export or even take a screenshot of the graph. Any ideas? My machine is Windows XP Pro and has 2GB memory. Many thanks in advance. ...

R chart by date

Hi all, I've got transactional data from a SQL query which I turn into a data frame. The first column of the df contains UNIX timestamps (format="%Y/%d/%m %H:%M") which I would like to use to create a graphics plot using par to display 1 unique lineplot per date. At the moment I am fumbling around with splitting column 1 and comparing wi...

Joining means on a boxplot with a line (ggplot2)

I have a boxplot showing multiple boxes. I want to connect the mean for each box together with a line. The boxplot does not display the mean by default, instead the middle line only indicates the median. I tried ggplot(data, aes(x=xData, y=yData, group=g)) + geom_boxplot() + stat_summary(fun.y=mean, geom="line") This does ...

R: Sort multiple columns by another data.frame?

I'm trying to make sense of how to sort one data.frame based on multiple columns in another. This question does this with vectors. Can someone suggest a way to do the equivalent with data.frames? Here's some sample data. x1 <- data.frame(a=1:5, b=letters[1:5], c=rnorm(5)) x2 <- data.frame(a=c(4,4,2), b=c("d", "d", "b"), d=rnorm(3)) ...

how can I suppress output from Sweave that is not suppressed by echo=FALSE?

I am getting extraneous output in my .tex file that I can not suppress with <> or sink(). Notably, the unwanted lines are not enclosed by ..{Schunk} or similar. This occurs for me when I use either DEoptim or rjags, although this is likely not limited to these functions. example .Rnw file: \documentclass[a4paper, 12]{article} begin{do...