r

Loading data from Excel file into Octave

I have an Excel file with a large set of data. The built-in graphs available in Excel are not enough to analyze these data, so I am thinking about using some tool like octave or R. I was thinking about some method to load an Excel file directly into octave or R. I searched the web and found that many people have succeeded using by expor...

sql command for reading a particular sheet, column ...

Dear All ... This is probably a very stupid question for SQL stalwarts, but I just want one SQL command. Details, I am using a data analysis tool called R, this tool uses ODBC to read data from XLS. I am now trying to read data from an XLS file. The ODBC tool in R accepts SQL commands. Question, Can someone give me an SQL command th...

How to connect to R with Java (using Eclipse)

Very newbie (to Java) question: I opened an Rserve connection (http://www.rforge.net/Rserve/) on localhost, and I would like to use the REngine client (src/client/java-new in the Rserve package) to connect to it. What do I need to do to get the "RTest.java" (located in src/client/java-new/Rserve; pasted below) to compile? I gather tha...

Good intro books for R

I have a slew of Springer books on specific packages, but my library is lacking a good solid book on R the language. While a language spec book would be great, it would be nice if I could find a book that has a solid founding in the language itself but couched in the examples that typify the day to day work of R users - statistics, visua...

Visualizing Data in Java

Hi, is there a good library on the market to visualize big datas in Java. Maybe a library for statistical outputs. I know the programming language R to visualize statistical data in R. I also have seen a solution to connect Java and R. It would be better if a have a pure Java solution. ...

Using function arguments in update.formula

I am writing a function that takes two variables and separately regresses each of them on a set of controls expressed as a one-sided formula. Right now I'm using the following to make the formula for one of the regressions, but it feels a bit hacked-up: foo <- function(x, y, controls) { cl <- match.call() xn <- cl[["x"]] xf ...

Step-by-Step How-to on Mediation Analysis in R

I'd like to know if anybody can provide a step-by-step how to on how to use mediation analysis using Keele, Tingley, Yamamoto and Imai's mediation package. I think there are two approaches to this - the classic Baron and Kenny (1986) and the new one by Preacher, Rucker and Hayes (2007) - I'd like to know how to do both approaches in R ...

Hooking R from within Excel - DCOM? R add in for Excel?

In the past I have used a DCOM connection to call R functions from Excel and from VBA inside of Excel. I just got a new laptop and have been looking for the install files for the R add in for Excel. I find references to it all over the place but they all point to R (D)COM Server project's home page at http://sunsite.univie.ac.at/rcom. Th...

R for finance tutorials/resources

Could someone recommend resources (websites, books, mailing lists, forums, anything) about programming in R with use of financial data? Anyone? :) ...

R: Multiline Comment Workarounds?

I (sort of) already know the answer to this question. But I figured it is one that gets asked so frequently on the R Users list, that one solid good answer belongs on SO. To the best of my knowledge there is no multiline comment functionality in R. So, do you have any good workarounds? While quite a bit of work in R usually involves ...

How to set alpha in R?

I have this example from the coin package of R: library(coin) library(multcomp) ### Length of YOY Gizzard Shad from Kokosing Lake, Ohio, ### sampled in Summer 1984, Hollander & Wolfe (1999), Table 6.3, page 200 YOY <- data.frame(length = c(46, 28, 46, 37, 32, 41, 42, 45, 38, 44, 42, 60, 32, 42, ...

Global variables in R

Hello all, I am a newbie in R programming. Though I am poking into the manuals, I also wanted to ask the community "How can we set global variables inside a function?" Any pointers will help. Question-2: Regarding plotting, I am using plotting multiple graphs in a single sheet, and to differentiate each one of them, I want to add tit...

How do you implement Velicer's MAP criterion in R

I'm looking at the psych package and the VSS tutorial, do I simply replace VSS with MAP? Like this: MAP(x, n = 8, rotate = "varimax", diagonal = FALSE, fm = "pa", n.obs=NULL,plot=TRUE,title="Very Simple Structure",...) or is there another way to do this? I've doing factor analysis right now and I'm using the elbow method on a scree pl...

Should "while loops" be preferred to "for loops" for large, necessary loops in R?

Realizing that loops are usually not ideal in R, sometimes they are necessary. When writing large loops, doesn't for (i in 1:large_number) waste memory, since a vector of size large_number must be created? Would this make while loops the best choice for large, necessary loops? ...

Overall Title for Plotting Window

If I create a plotting window in R with m rows and n columns, how can I give the "overall" graphic a main title? For example, I might have three scatterplots showing the relationship between GPA and SAT score for 3 different schools. How could I give one master title to all three plots, such as, "SAT score vs. GPA for 3 schools in CA"? ...

Histogram with Logarithmic Scale

I'm currently trying to generate a histogram in R on a logarithmic scale, but I haven't the clue where to start. I've looked on Google but none of the stuff I've seen really does what I want. To plot the histogram I'm using: hist(mydata$V3, breaks=c(0,1,2,3,4,5,25)) This gives me a histogram, but the density between 0 to 1 is so gre...

R: Using the apply function on a data frame. Help me get my vector, Victor.

I'm trying to normalize some data which I have in a data frame. I want to take each value and run it through the pnorm function along with the mean and standard deviation of the column the value lives in. Using loops, here's how I would write out what I want to do: #example data hist_data<-data.frame(matrix(rnorm(200,mean=5,sd=.5),nrow=...

Side-by-side plots with ggplot2 in R

I would like to place two plots side by side using the ggplot2 package (ie. do the equivalent of par(mfrow=c(1,2))). For example, I would like to have the following two plots show side-by-side with the same scale. x <- rnorm(100) eps <- rnorm(100,0,.2) qplot(x,3*x+eps) qplot(x,2*x+eps) Do I need to put them in the same data.frame lik...

[R] how to fill empty values in a data frame with neighbouring values

862 2006-05-19 6.241603 5.774208 863 2006-05-20 NA NA 864 2006-05-21 NA NA 865 2006-05-22 6.383929 5.906426 866 2006-05-23 6.782068 6.268758 867 2006-05-24 6.534616 6.013767 868 2006-05-25 6.370312 5.856366 869 2006-05-26 6.225175 5.781617 870 2006-05-27 NA NA I have a da...

Plot time data in R to various resolutions (to the minute, to the hour, to the second, etc.)

I have some data in CSV like: "Timestamp", "Count" "2009-07-20 16:30:45", 10 "2009-07-20 16:30:45", 15 "2009-07-20 16:30:46", 8 "2009-07-20 16:30:46", 6 "2009-07-20 16:30:46", 8 "2009-07-20 16:30:47", 20 I can read it into R using read.cvs. I'd like to plot: Number of entries per second, so: "2009-07-20 16:30:45", 2 "2009-07-20 16:...