Re: [R] diff doesnot work

2017-02-06 Thread William Dunlap via R-help
diff() does not work on data.frames so you need to give it a column from the data.frame, as a vector. diff(data.frame(P=c(1,2,3,5,7,11,13,17))$P) [1] 1 1 2 2 4 2 4 You get different errors for multi- and single-column data.frames > diff(data.frame(P=c(1,2,3,5,7,11,13,17), F=c(1,1,2,3,5,8,13,

[R] diff doesnot work

2017-02-06 Thread george brida
Dear R users, I have a txt file entitled coc composed by one column of numeric values without header and having 50 rows. This file is under the following path: C:\\Users\\intel\\Documents\\TR I have written the following lines: xcx=read.table("C:\\Users\\intel\\Documents\\TR\\coc.txt",header=F)