Questions for r


7711

How to add a 2nd y-axis for a density plot superimposed on a histogram in R?

I have a histogram shown below, and I have added 2 density plots on top of that. It corresponds to the 2 classes that make up the data.
5009

How to write coercion methods

I'm having a bunch of custom-made Reference Classes and would like to write coercion methods for some of them. It'd be nice if a function call would look like this:
5564

How to get started with Big Data Analysis

I've been a long time user of R and have recently started working with Python. Using conventional RDBMS systems for data warehousing, and R/Python for number-crunching, I feel the need now to get my
8769

How to manually set coefficients for variables in linear model?

In R, how can I set weights for particular variables and not observations in lm() function?
4883

R - How to sum objects in a column between an interval defined by conditions on another column

This comes as an application to this question:Sum object in a column between an interval defined by another column
4475

Create a table for N, Min/Max, SD, Mean, and Median in R

I'm very new to R, so please bear with me on this basic question.
5779

How can an line be overlaid on a a bar plot using ggplot2?

I'm looking for a way to plot a bar chart containing two different series, hide the bars for one of the series and instead have a line (smooth if possible) go through the top of where bars for the ...
7708

R Cannot allocate memory though memory seems to be available

After running several models I need to run a system() command on my R script to shutdown my EC2 instance, but when I get to that point I get:
4862

ggplot2 plot fill page in landscape (pdf)

I'm trying to render a plot to a PDF using the following approach:
9631

Extracting Certain Data from a Data Set Using R

I have difficulties in extracting certain line from a data.
7009

Discarding non-decimal values in R

I've got the a data frame called "odds" in R containing a couple of odds I kept track of in several formats:
5674
2720

Sample with constraint, vectorized

What is the most efficient way to sample a data frame under a certain constraint?
5466
2237
2021

How do I set values to a Tk combobox in R

I sometimes have a dropdown box with only one item to choose from, but this item might be a string with spaces. How can I do this in R? Here is the problem:
779

How can I color the ocean blue in a map of the US?

I would like to draw a map of the US over an image, but then fill in the oceans.
1108
3093

R: format the output of `warning()` for a list of options over more than one line

I'm writing error handling steps for an R function that fails to find the right match to a query, so presents users with a list of options. I have the output of potential matches in a list, and I'...
6964

Beginner's questions (figures, bibliography) with Sweave/R/LaTeX---my first document

I am just starting with Sweave and with R. Here I am using R to output some data and I am also trying to include a plot. The code does not sweave. I have one Sweave example from the web that compiles
6334

Plot only diagonal entries with data.frame of many time-series in R

I have several time series, which when I plot using,
1728

R as a general purpose programming language

I liked Python before because Python has rich built-in types like sets, dicts, lists, tuples. These structures help write short scripts to process data.
9466

What's the fastest way to merge/join data.frames in R?

For example (not sure if most representative example though):
8276

Why I obtain wrong answer when using “==”

Something I do not understand is happening on two of my computers. I wonder why this is happening:
6490

R incrementing by decimal value does not return expected value

I am writing a function in R that requires me to increment a counter by 0.05. When I condition on the value of the counter I am getting told that the value is not what it appears.
437

How to add layers with new data to a ggplot with a POSIX axis?

I'm used to this if I want to add a point to a ggplot, it works just fine:
5682

using stringr to split vectors, unexpected result length

Something simple I'm messing up in using stringr to manipulate character vectors. I have a data frame of the following sort
1890

Save graph from R as editable graphic in Excel

I am writing a GUI in R, and one of the functions I must implement is a button to save graphical output to an Excel sheet, ideally the graphic should be editable in Excel. I am trying to do this the
6561

big.matrix as data.frame in R

I've recently started using R for data analysis. Now I've got a problem in ranking a big query dataset (~1 GB in ASCII mode, over my laptop's 4GB RAM in binary mode). Using bigmemory::big.matrix fo...
9625

R 2.14 byte compilation - how much performance increase

I saw that the latest R version supports byte compilation. What is the performance gain I can expect? And are specific tasks more positively impacted that others?
6368

R: Plotting 4x4 plot with for -loop and png, why getting 1x1 plot instead of 4x4?

I can get the 4x4 plot working when I try it on command line but not with for -loop and png element in the code below. I am frustrated what the heck the problem is, I have tried to understand this ...
4727

Change dots of a ggplot to text labels

Recently i asked a question about getting multiple graphs within 1 picture. I got some pretty good answers but 1 question still remains.
1919

Group rows by attributes

I have a data frame containing data about student lateness to various classes. Each row contains data about a late student and his class: date and time of the class, name of the class, class size, ...
793

My R has memory leaks?

I'm using R 2.15.3 on Ubuntu 12.04 (precise) 64-bit.
6062

Subset data using non-sequential row numbers

I have a data frame with 30 rows and 100 columns (X).
6227

R - How to do Python's Try Except

I'm starting to work with R. Although I'm more used to python.
9238

Predicted Probabilities with Predict.Plot

I'm running the following logistic regression model in R and one of the important predictors is our_bid, which is a numeric and continuous variable that ranges from 0.30 to 0.80. When I attempt to...
4171

R lapply statement with index

Is there a way I can make an lapply statement also show the index? More specifically, consider the following example:
642

Regular expression in R

I am having some troubles with the regular expression in R. I use str_extract from the library stringr and my problem is :
7441

Solving quadratic programming using R

I would like to solve the following quadratic programming equation using ipop function from kernlab :
3041

Apply function on each cell in a column and add the result to a new column

I have a data.table as shown below. What I want is to apply a function to each of the elements in column C. The function will take in a vector(since Col C contains vector elements) and return another
7179

R and ggplot- Changing x axis to Date removes position dodge

I've been using ggplot to create plots, and I always like to offset my data points horizontally so the error bars don't overlap. I've found that when I used Date data for my x axis, I loose the abi...
6406

Efficient way to define a class with multiple, optionally-empty slots in S4 of R?

I am building a package to handle data that arrives with up to 4 different types. Each of these types is a legitimate class in the form of a matrix, data.frame or tree. Depending on the way the dat...
1710

How do I call a namespaced function without evaluating the parameters you are giving it?

In R, the idiomatic way to call another function without evaluating the parameters you give it is apparently as follows:
1009

Trouble reading a data set into R

I am new to R and I am trying to read in a data set. The data set is here:
7368

Plotting multiple columns with ggplot2

I need to plot the following dataset in the same graph.
2886

How to install 2 different R versions on Debian?

On our server, R 2.12.1 is installed following the instructions on http://cran.r-project.org/bin/linux/debian/ , using apt-get install etc etc.
7807

How do I calculate weighted degree distributions with igraph in R?

Consider a dataframe df where the first two columns are node pairs and successive columns V1, V2, ..., Vn represent flows between the nodes (potentially 0, implying no edge for that column's networ...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.