### Remove NA and Inf (by replacing inf and -inf with NA)
df <- read.table("data.csv", sep=',')
df <- do.call(data.frame,
lapply(df, function(x) replace(x, is.infinite(x), NA))) # replacing inf (and -inf) with NA
df <- na.omit(df)
### Select a part of data frame (columns) by columns
df <- subset(df, select=c("name1", "name2"))
# Select rows by conditions
df <- subset(df, name1 > 1)
### Change index name of a dataframe
rownames(df) <- list_of_new_row_names