1

My script is an R script. I have this error message : Error in eval.quoted(.variables, data) : envir must be either NULL, a list, or an environment. Calls: ddply -> splitter_d -> eval.quoted

dataset = read.csv("/home/eby/Documents/Data/train_FD001_01.txt", sep="\t", header=TRUE, row.names=NULL)
dfrm <- data.frame(dataset)
dataset <- as.matrix(dfrm)

# generate the column RUL (remaining useful life)
library(plyr)

# get the maximum cycle number for each id
d1 <- ddply(dataset,~id,summarise,max=max(cycle))

My dataset is :

id      cycle
1       1
1       2
2       1
2       2
2       3
2       4

I want to get the maximum cycle number for each id. My code runs under RapidMiner but not directly in RStudio.

dede
  • 91
  • 1
  • 7
  • What's in `dataset` ? What is your expected output? – mtoto Mar 31 '16 at 08:46
  • I answered you in my post. – dede Mar 31 '16 at 08:58
  • Please restrict your post to a minimum example, also data that you posted doesn't illustrate your question as all id's have `1` for `cycle`. And I don't see your expected output either. – mtoto Mar 31 '16 at 09:04
  • Yes, I have updated my dataset. – dede Mar 31 '16 at 09:24
  • ddply need a data.frame not a matrix !!! Good solution : d1 <- ddply(dfrm,~id,summarise,max=max(cycle)) This question is not duplicated !!! The answer don't help me. @henrick – dede Mar 31 '16 at 09:58

0 Answers0