Hi all,
I created a network graph from data on flows between US states. For each vertex, I have the lat/long of the state.
I am hoping to recreate a network kind of graph that shows the edges, except that I set the location of each vertex to be their geographic position and have a state boundary map in the background.
I am using to ...
Hi everybody,
I'm checking a simple moving average crossing strategy in R. Instead of running a huge simulation over the 2 dimenional parameter space (length of short term moving average, length of long term moving average), I'd like to implement the Particle Swarm Optimization algorithm to find the optimal parameter values. I've been b...
Hi,
Below are the first five rows of the imported data in R:
data[1:5,]
user event_date day_of_week
1 00002781A2ADA816CDB0D138146BD63323CCDAB2 2010-09-04 Saturday
2 00002D2354C7080C0868CB0E18C46157CA9F0FD4 2010-09-04 Saturday
3 00002D2354C7080C0868CB0E18C46157CA9F0FD4 2010-09-07 Tuesday
4 00002D2354C7080C0868CB0E18C46157...
I am revising a paper for submission and would like to replace the old lattice graphics with shiny new ggplot2 versions. However, I run into compatibility problems between ggplot2 and two packages that are absolutely crucial for my analyses, coin and arm. When executing the following example from the manual
qplot(sleep_rem / sleep_total...
Hi R users,
I would like to know how I would go about performing image analysis in R. My goal is to convert images into matrices (pixel-wise information), extract/quantify color, estimate the presence of shapes and compare images based on such metrics/patterns.
I am aware of relevant packages available in Python (suggestions relevant t...
I am trying to use R to create a raster image from a matrix of data. However, I am getting some weird artifacts on the edge of my image.
The code I am using is as follows:
# From the example for rasterImage(). A 3 pixel by 5 pixel b/w checkerboard.
testImage <- as.raster(0:1, nrow=3, ncol=5)
testImage
[,1] [,2] [,3] ...
Hi R users,
I am working on a project where I have a lot of analysts creating statistical models in R. They usually provide me with the model objects (.Rdata files) and I automate executing them for various datasets.
My problem is:
Can I use a database and save these .RData files there ? Any hints on doing this? ( I currently store t...
Hello,
I am currently using apTreeshape to simulate phylogenetic trees using the "Yule-Hardy" Method. What I want to do is randomly generate between 20 and 25 different numbers for three different groupings (small, medium and large trees) and then generate about 40 trees for every random number chosen from within the grouping.
I know h...
Stackoverflow now supports chats -- see your toolbar between tools and meta.
With that, I just set one up for R which you can visit here.
...
So I was sitting around thinking (It's very Greek, I know) and a question popped into my head. If I wanted to have a little real time chat about R and maybe have some dialog about data related work flows, where could I go? I don't really like IRC because I have a beard, but no suspenders. Is there something more hip than IRC?
...
I'm working on a PHP web app that calls R through curl and RApache. Most things work fine. But one lattice plot throws this error:
RApache Warning/Error!!!Error in uy +
c(-1, 1) : non-numeric argument to
binary operator
I tried saving the data structures that feed into the plot and doing the plot in my local R, but then the pl...
What packages and functions in R can perform a two dimensional non-additive local regression/smooth. For example consider
b<-seq(-6*pi,6*pi,length=100)
xy<-expand.grid(b,b)
x=xy[[1]]
y=xy[[2]]
z= sin(x)+cos(y) + 2*sin(x)*cos(y)
contour(b,b,matrix(z,100,100))
What functions could estimate this?
...
Hi.
I have a contour plot in ggplot2 that I want to map one point to.
My contour plot looks like this:
v = ggplot(pts, aes(theta_1, theta_2, z = z))
v + stat_contour(aes(colour = ..level..),bins=50)
+ xlab(expression(Theta[1])) + ylab(expression(Theta[2]))
and I have a point that looks like this:
p = ggplot(ts,aes(x,y))
p + geom_p...
Possible Duplicate:
Quickly reading very large tables as dataframes in R
Hi,
trying to read a large dataset in R the console displayed the follwing errors:
data<-read.csv("UserDailyStats.csv", sep=",", header=T, na.strings="-", stringsAsFactors=FALSE)
> data = data[complete.cases(data),]
> dataset<-data.frame(user_id=as.char...
I have a list containing 6 plots, made like this:
voi=c('inadist','smldist','lardist')
plist<-llply(voi, function(v,df,s) {
list( assign(paste(v,'.violin'), bwplot(groupname~df[,which(colnames(df)==v)]|fCycle*fPhase, data=df, groups=groupname, col=rainbow(1), box.ratio=3,
main=paste('Dis...
Hello,
I ran into a little problem using R…
In the following data frame
test <- data.frame(v1=c(rep(1,3),rep(2,3)),v2=0)
I want to change values for v2 in the rows where v1 is 1.
test[test$v1==1,"v2"] <- 10
works just fine.
test
v1 v2
1 1 10
2 1 10
3 1 10
4 2 0
5 2 0
6 2 0
However, I need to do that in a function.
...
I have a CSV with a bunch of data like so:
> test.csv <- read.csv("~/Desktop/stats.csv")
> test.csv
m lvl a b c a_pct b_pct c_pct d_pct
1 543557 2A 13 255 59.6666667 18.8 10.2 1.6 5.1
2 545059 2A 0 19 4.0000000 15.8 15.8 5.3 ...
I have a data.frame (link to file) with 18 columns and 11520 rows that I transform like this:
library(plyr)
df.median<-ddply(data, .(groupname,starttime,fPhase,fCycle),
numcolwise(median), na.rm=TRUE)
according to system.time(), it takes about this long to run:
user system elapsed
5.16 0.00 5.17
This...
I recently installed R-2.12.0 from R-2.11.1 and I've updated all CRAN packages via:
update.packages(checkBuilt=TRUE, ask=FALSE)
Now I want to update all the packages I have installed from R-forge, but only if they're not available on CRAN. In other words, I cannot simply run:
update.packages(checkBuilt=TRUE, ask=FALSE, repos="http:/...
similar questions have raised for other languages: C, sql, java, etc. But I'm trying to do it in R.
I have
ret_series <- c(1, 2, 3);
x <- "ret_series";
How do I get (1, 2, 3) by calling some function / manipulation on x, without direct mentioning of ret_series?
...