Hello, struggling with the very basic needs... :( any help appreciated.
#using the package doBY #who drinks how much beer per day and therefor cannot calculate rowise maxvals evaluation=data.frame(date=c(1,2,3,4,5,6,7,8,9), name=c("Michael","Steve","Bob", "Michael","Steve","Bob","Michael","Steve","Bob"), vol=c(3,5,4,2,4,5,7,6,7)) evaluation # maxval=summaryBy(vol ~ name,data=evaluation,FUN = function(x) { c(ma=max(x)) } ) maxval # over all days per person #function getMaxVal=function(x) { maxval$vol.ma[maxval$name==x] } getMaxVal("Steve") # testing the function for one name is ok #we want to add a column, that shows the daily drinkingvolume in relation to the persons max-vol. evaluation[,"relDrink"]= evaluation$vol/getMaxVal(evaluation$name) # # this brings the error: # #Warning message: # Korrupter Data Frame: Spalten werden abgeschnitten oder mit NAs # aufgefüllt in: format.data.frame(x, digits = digits, na.encode = FALSE) errortest= evaluation$vol/getMaxVal(evaluation$name) errortest # this brings: # numeric(0) #target was the following: #show in each line the daily consumed beer per person and in the next column #the all time max consumed beer for this person´(or divided by daily vol): # # date name vol relDrink #1 1 Michael 3 7 #2 2 Steve 5 6 #3 3 Bob 4 7 #4 4 Michael 2 7 #5 5 Steve 4 7 #6 6 Bob 5 7 #7 7 Michael 7 7 #8 8 Steve 6 6 #9 9 Bob 7 7 # who can help??? -- Das, was wir als freie Entscheidung erfahren, ist nichts als eine nachträgliche Begründung von Zustandsveränderungen, die ohnehin erfolgt wären. Wolf Singer, Max-Planck-Institut für Gehirnforschung [[alternative HTML version deleted]]
______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.