r-faq
Only read selected columns
Can anyone please tell me how to read only the first 6 months (7 columns) for each year of the data below, for example by using read.table()?[详细]
2023-04-12 17:11 分类:问答Replacing NAs with latest non-NA value
In a data.frame (or data.table), I would like to "fill forward" NAs with the closest previous non-NA value. A simple example, using vectors (instead of a data.frame) 开发者_开发百科is the fo[详细]
2023-04-12 04:44 分类:问答Add regression line equation and R^2 on graph
I wonder how to add regression line equation and R^2 on the ggplot. My code is: library(ggplot2) df <- data.frame(x = c(1:100))[详细]
2023-04-07 18:16 分类:问答One function to detect NaN, NA, Inf, -Inf, etc.?
Is there a single function in R that determines if a value is NA,开发者_C百科 NaN, Inf, -Inf, or otherwise not a well-formed number?You want is.finite[详细]
2023-04-06 23:14 分类:问答Count number of rows per group and add result to original data frame
Say I have a data.frame object: df <- data.frame(name=c(\'black\',\'black\',\'black\',\'red\',\'red\'),[详细]
2023-04-05 05:43 分类:问答Changing date format in R
I have some very simple data in R that needs to have its date format changed: date midpoint 131/08/20110.8378[详细]
2023-04-05 01:43 分类:问答How to subset matrix to one column, maintain matrix data type, maintain row/column names?
When I subset a matrix to a single column, the result is of class numeric, not matrix (i.e. myMatrix[ , 5 ] to subset to the fifth 开发者_如何学运维column).Is there a compact way to subset to a single[详细]
2023-04-03 19:20 分类:问答Error in if/while (condition) {: missing Value where TRUE/FALSE needed
I received this error message: Error in if (co开发者_StackOverflow社区ndition) { : missing value where TRUE/FALSE needed[详细]
2023-04-03 10:55 分类:问答How can two strings be concatenated?
How can I concatenate (merge, combine) two values? Fo开发者_如何学Gor example I have: tmp = cbind(\"GAD\", \"AB\")[详细]
2023-03-30 18:12 分类:问答Migrating R libraries
I\'d like to move several R libraries (*) from one drive to another, on Linux, and would like to know whether a simple move is feasible and safe or if I should uninstall and reinstall the packages.I r[详细]
2023-03-29 18:20 分类:问答