Get the number of lines in a text file using R?

Is there a way to get the number of lines in a file without importing it? So far this is what I am doing myfiles &...

Test if a vector contains a given element?

How to check if a vector contains a given value? ...

Error faced while using TM package's VCorpus in R?

I am facing the below error while working on the TM package with R. library("tm") Loading required package: NLP Wa...

Transparency with polygon command?

I used the polygon command in R which created an area in the plot. However, the values in this area are not shown wh...

Translating Stata to R: collapse?

Just came across a .do file that I need to translate into R because I don't have a Stata license; my Stata is rusty,...

Split code over multiple lines in an R script?

I want to split a line in an R script over multiple lines (because it is too long). How do I do that? Specifically,...

Error: C stack usage is too close to the limit in Windows environment?

I'm doing geostatistical interpolations in R on a 5600 x 5700 matrix and, despite having available memory, I'm getti...

Return index of the smallest value in a vector??

a <- c(1, 2, 0, 3, 7) I am looking for a function to return the index of the smallest value, 3. What is it? ...

How to rank rows by two columns at once in R??

Here is the code to rank based on column v2: x <- data.frame(v1 = c(2,1,1,2), v2 = c(1,1,3,2)) x$rank1 <- ran...

Adding a column of a categorical variables in sequence to a data frame list?

I have multiple data frames that I've read into one list. I want to add new column of a specific sequence of categor...

Error with select function from dplyr?

When I use the select function from dplyr, it doesn't work and gives me an error stating that the column names that ...

Points in a map with qmplot?

I have to plot some points in a map. I want to use qmplot, because it seems simple and effective. I have followed t...