Skip to main content

Questions tagged [r]

R is a free, open-source programming language & software environment for statistical computing, bioinformatics, visualization & general computing. Please use minimal reproducible examples others can run using copy & paste. Show desired output entirely. Use dput() for data & specify all non-base packages with library(). Don't embed pictures for data or code, use indented code blocks instead. For statistics questions, use https://stats.stackexchange.com.

13 votes
4 answers
4k views

outer() equivalent for non-vector lists in R

I understand how outer() works in R: > outer(c(1,2,4),c(8,16,32), "*") [,1] [,2] [,3] [1,] 8 16 32 [2,] 16 32 64 [3,] 32 64 128 It basically takes 2 vectors, finds the ...
poundifdef's user avatar
  • 19.3k
1 vote
2 answers
3k views

ggplot2: using the geom_area() function

I have a data frame showing four classes for each year, along with their respective shares of the total for that year. > head(df) class year share 1 class1 1975 0.806 2 class2 1975 0....
MW Frost's user avatar
  • 980
25 votes
10 answers
14k views

Stopwatch function in R

Is there an R timer or stopwatch function similar to MATLAB's tic/toc?
wahalulu's user avatar
  • 1,467
2 votes
1 answer
4k views

How to export data from ROCR package

I am trying to export biometric data from an analysis using the ROCR package. Here is the code that I've done so far: pred = performance(Matching.Score,Distribution) perf = prediction(pred,"fnr", "...
Mattey Gee's user avatar
51 votes
3 answers
78k views

Multivariate time series modelling in R

I want do fit some sort of multi-variate time series model using R. Here is a sample of my data: u cci bci cpi gdp dum1 dum2 dum3 dx 16.50 14.00 53.00 45.70 80....
Karl's user avatar
  • 5,766
0 votes
3 answers
855 views

Strange error when using sparse matrices and glmnet

I'm getting a weird error when training a glmnet regression. invalid class "dgCMatrix" object: length(Dimnames[[2]])' must match Dim[2] It only happens occasionally, and perhaps only under larger ...
Brendan OConnor's user avatar
31 votes
2 answers
25k views

How to run R on a server without X11, and avoid broken dependencies

I'm running R 2.9 on a large EC2 Ubuntu instance, loaded with RAM, but without a terminal. When I load a library that has display dependencies, such as the sqldf package, I receive the following ...
medriscoll's user avatar
  • 27.3k
18 votes
1 answer
5k views

Generating non-duplicate combination pairs in R

Sorry for the non-descriptive title but I don't know whether there's a word for what I'm trying to achieve. Let's assume that I have a list of names of different classes like c( '1', '2', '3', '4') ...
lhahne's user avatar
  • 5,979
21 votes
12 answers
2k views

What useful R package doesn't currently exist? [closed]

I have been working on a few R packages for some general tools that aren't currently available in R: blogging, report delivery, logging, and scheduling. This led me to wonder: what are the most ...
17 votes
2 answers
4k views

Debugging generic functions in R

How do you debug a generic function (using debug, or mtrace in the debug package)? As an example, I want to debug cenreg in the NADA package, specifically the method that takes a formula input. You ...
Richie Cotton's user avatar
6 votes
2 answers
3k views

Is there a free Statistics Package for Delphi?

Is there an open source and/or free statistics package or library for Delphi? I'm looking for something that can compile directly into the executable, so no DLL's. It needs to be compatible with ...
lkessler's user avatar
  • 20.1k
212 votes
9 answers
481k views

For each row in an R dataframe

I have a dataframe, and for each row in that dataframe I have to do some complicated lookups and append some data to a file. The dataFrame contains scientific results for selected wells from 96 well ...
Carl Coryell-Martin's user avatar
7 votes
3 answers
3k views

Applying a function to a distance matrix in R

This question came today in the manipulatr mailing list. http://groups.google.com/group/manipulatr/browse_thread/thread/fbab76945f7cba3f I am rephrasing. Given a distance matrix (calculated with ...
Eduardo Leoni's user avatar
0 votes
1 answer
688 views

Per panel smoothing in ggplot2

I'm plotting a group of curves, using facet in ggplot2. I'd like to have a smoother applied to plots where there are enough points to smooth, but not on plots with very few points. In particular I'd ...
mo-seph's user avatar
  • 6,173
192 votes
9 answers
409k views

Filter data.frame rows by a logical condition

I want to filter rows from a data.frame based on a logical condition. Let's suppose that I have data frame like expr_value cell_type 1 5.345618 bj fibroblast 2 5.195871 bj fibroblast 3 ...
lhahne's user avatar
  • 5,979

15 30 50 per page