[R] print(cat(bleh)) shows up strange NULL

Dan Bolser dmb at mrc-dunn.cam.ac.uk
Tue Jan 4 23:11:31 CET 2005


I am trying the following code...

for(i in 1:bins){
  print(cat(c(i, length(var1[var1==i]))))
}

Where var1 is a vector with zero or more values = {1, 2, ..., bins} (or
something like that).

The result I get is...

1 33NULL
2 28NULL
3 39NULL
4 27NULL
5 32NULL
6 30NULL
7 23NULL
8 16NULL
9 10NULL
10 15NULL
11 13NULL
12 7NULL
13 3NULL
14 7NULL
15 2NULL
16 0NULL
17 2NULL
18 0NULL
19 0NULL
20 3NULL

I don't know what I am doing to get those stray NULL characters printed.

I also tried...

for(i in 1:bins){
  print(cat(i, length(var1[var1==i])))
}

Which is essentially the same.




More information about the R-help mailing list