I want to import a tsv file including some non-numeric fields (i.e., date or string) in R:
num1 num2 date
1 2 2012-10-18 12:17:19
2 4 2014-11-16 09:30:23
4 11 2010-03-18 22:18:04
12 3 2015-02-18 12:55:50
13 1 2014-05-16 10:39:11
2 14 2011-05-26 20:48:54
I am using the following command:
a = read.csv("C:\test\testFile.tsv", sep="\t")
I want to ignore all non-numeric values automatically (or put something like "NA"). And don't want to mention all the string column names to be ignored.
I tried "stringsAsFactors" and "as.is" parameters, with no success.
Any ideas?
a <- a[sapply(a,is.numeric)]