There are two other places where I have induced a core dump.
x1 <- 1:10
f1 <- cut(x,5); f2 <- cut(x,4); f3 <- cut(x,3)
as.matrix(list(f1,f2,f3))
----------------------------------------------------
Just after start-up, as the first expression issued:
strwidth("abcd")
-----------------------------------------------------
One other place: where the documentation says that f1:f2
works when f1,f2 are factors
f1 <- gl(3,2)
f2 <- gl(2,3)
f1:f2
It doesn't core dump, but it doesn't seem to do anything
useful either. Is the intent to create what
tapply(1:6,list(f1,f2)) creates?
------------------------------------------------------
I am starting this week to teach a 'graphical EDA using R'
course to undergrauate business students with very little
math or computer language experience. I have been
intentionally 'abusing' R to look for places that my
students might inadvertenly stumble into. The focus on the
course is graphical exploration of data, and data
manipulation will be an important component of my students
learning experience.
If I may, a personal comment about tapply. This may be just
something that I don't understand fully. If this is just my
confusion, or it no longer happens in the latest version,
ignore my comments with my apologies.
The core dump situation I described in my previous post came
up in my attempt to 'generalize' the tapply function. In
looking at ways to teach R, it seemed that tapply would
accept a list of factors if the function being applied
returned a scalar, or a single factor if the function being
applied returned a vector, but it core dumped if it was used
as
tapply(x,listOfFactors,vectorReturningFunction)
My naive solution was :
j <- tapply(x, listOfFactors) # get the product factor
answer <- tapply(x,j,vectorReturningFunction)
.... CODE TO GET THE LABELS RIGHT ....
ansmat <- array(unlist(answer), dim=someStuff,
dimnames=otherStuff))
The 'flexibility' of being passed back different structures
(list, vector, matrix) depending upon the input structures
somewhat complicates the explanation of the functions'
usage. Uniformly returning a properly labelled array, in my
naive way of looking at things, might have some merit.
Although I am not new to programming (started as an
undergraduate engineer in the early 60's) I am new to user
group lists on the Internet. I don't know what the proper
'group etiquette' is on things like code bombing questions.
Thank you,
Norm
Norman Josephy
Department of Mathematical Sciences
Bentley College
Waltham, MA
U.S.A.
E-Mail: NJOSEPHY@BENTLEY.EDU