Sample random rows in dataframe?

I am struggling to find the appropriate function that would return a specified number of rows picked up randomly wit...

Determining if a matrix is diagonalizable in the R Programming Language?

I have a matrix and I would like to know if it is diagonalizable. How do I do this in the R programming language? ...

Return a data frame from function?

I have the following code inside a function Myfunc<- function(directory, MyFiles, id = 1:332) { # uncomment the ...

How can I replace TRUE and FALSE values with 1 and 0 when exporting data in R??

I am exporting data from R with the command: write.table(output,file="data.raw", na "-9999",sep="\t",row.names=F,co...

The difference between bracket [ ] and double bracket [[ ]] for accessing the elements of a list or dataframe?

R provides two different methods for accessing the elements of a list or data.frame: [] and [[]]. What is the diffe...

What's the difference between integer class and numeric class in R?

I want to preface this by saying I'm an absolute programming beginner, so please excuse how basic this question is. ...

Special variables in ggplot (..count.., ..density.., etc.)?

Consider the following lines. p <- ggplot(mpg, aes(x=factor(cyl), y=..count..)) p + geom_histogram() p + sta...

How to extract Month from date in R?

I am using the lubridate package and applying the month function to extract month from date. I ran the str command o...

R not finding package even after package installation?

I have always worked with the zoo package, that I have installed a long time ago. Today, I created a new R script, a...

Flipping the X and Y values in a plot in R (with the data changing axes as well)?

How do I make a plot in R so that the value of a variable displays along the X axis and the variable names go vertic...

How to increase the font size of ggtitle in ggplot2?

I would like to increase the font size of ggtitle and also the font should be bold. My code is as follows. ggplot(d...

Piping stdin to R?

I am having trouble piping stdin to an R script. Here is my toy script test.R: #!/usr/bin/env Rscript while(length...

Convert Factor to Date/Time in R?

This is the information contained within my dataframe: ## minuteofday: factor w/ 89501 levels "2013-06-01 08:07:00"...

How to declare a vector of zeros in R?

I suppose this is trivial, but I can't find how to declare a vector of zeros in R. For example, in Matlab, I would...