I am new in R and I am trying to do something really simple. I had load a txt file with four columns and now I want to get the minimum value of the second column.
This is the code that I have:
## Choose the directory of the file
setwd("//Users//dkar//Desktop")
## Read the txt file
data<-read.table("export_v2.txt",sep="",header=T)
str(data)
## this command gives me the minimum for all 4 columns!!
a<-apply(data,2,min)
Actually, if I want to do something like this: min (data(:,2)). But I don’t know how to do it in R. Any help?
If you need minimal value for particular column
Note: R considers
NAboth the minimum and maximum value so if you have NA’s in your column, they return:NA. To remedy, use: