I suspect you are having a problem with factors. For example,
> x = factor(4:8)
> x
[1] 4 5 6 7 8
Levels: 4 5 6 7 8
> as.numeric(x)
[1] 1 2 3 4 5
> as.numeric(as.character(x))
[1] 4 5 6 7 8
Some comments:
- You mention that your vector contains the characters “Down” and “NoData”. What do expect/want
as.numericto do with these values? - In
read.csv, try using the argumentstringsAsFactors=FALSE - Are you sure it’s
sep="/tand notsep="\t" - Use the command
head(pitchman)to check the first fews rows of your data - Also, it’s very tricky to guess what your problem is when you don’t provide data. A minimal working example is always preferable. For example, I can’t run the command
pichman <- read.csv(file="picman.txt", header=TRUE, sep="/t")since I don’t have access to the data set.