On Tue, 2 Feb 2010, David Katz wrote:
Thanks, that helps! Subset creates a new context where a name clash can
occur. So if I don't want to check for that possibility, I should use a
special kind of index like .sch, or avoid subset:
for(sch in school.list){
print(sch)
print(input.data[input.d
Thanks, that helps! Subset creates a new context where a name clash can
occur. So if I don't want to check for that possibility, I should use a
special kind of index like .sch, or avoid subset:
for(sch in school.list){
print(sch)
print(input.data[input.data[,school.var] == sch,])}
which work
Hi:
Try this for your second loop instead:
for(s in school.list){
print(s)
print(subset(input.data, sch == s))
}
[1] 1
sch pop
1 1 100
2 1 200
[1] 2
sch pop
3 2 300
4 2 400
Don't confound the 'sch' variable in your data frame with the
index in your loop :)
HTH,
Dennis
On Mon,
3 matches
Mail list logo