How can I suppress (not print) line numbers?

Mary A. Marion

How can I suppress (not print) line numbers?
Code reads:

dd<-data.frame(a=gl(2,3),b=gl(3,1,6) ) 
model.matrix( ~a + b + a*b, dd )

Tries:

> dd<-data.frame(a=gl(2,3),b=gl(3,1,6) ) 
> model.matrix( ~a + b + a*b, dd )
  (Intercept) a2 b2 b3 a2:b2 a2:b3
1           1  0  0  0     0     0
2           1  0  1  0     0     0
3           1  0  0  1     0     0
4           1  1  0  0     0     0
5           1  1  1  0     1     0
6           1  1  0  1     0     1
attr(,"assign")
[1] 0 1 2 2 3 3
attr(,"contrasts")
attr(,"contrasts")$a
[1] "contr.treatment"
attr(,"contrasts")$b
[1] "contr.treatment"

> cat(model.matrix( ~a + b + a*b, dd ))
1 1 1 1 1 1 0 0 0 1 1 1 0 1 0 0 1 0 0 0 1 0 0 1 0 0 0 0 1 0 0 0 0 0 0 1
> model.matrix( ~ a + b + a*b, dd )
  (Intercept) a2 b2 b3 a2:b2 a2:b3
1           1  0  0  0     0     0
2           1  0  1  0     0     0
3           1  0  0  1     0     0
4           1  1  0  0     0     0
5           1  1  1  0     1     0
6           1  1  0  1     0     1
attr(,"assign")
[1] 0 1 2 2 3 3
attr(,"contrasts")
attr(,"contrasts")$a
[1] "contr.treatment"
attr(,"contrasts")$b
[1] "contr.treatment"

> dd<-data.frame(a=gl(2,3),b=gl(3,1,6) )
> print(model.matrix( ~a + b + a*b, dd , rowNames=False))
  (Intercept) a2 b2 b3 a2:b2 a2:b3
1           1  0  0  0     0     0
2           1  0  1  0     0     0
3           1  0  0  1     0     0
4           1  1  0  0     0     0
5           1  1  1  0     1     0
6           1  1  0  1     0     1
attr(,"assign")
[1] 0 1 2 2 3 3
attr(,"contrasts")
attr(,"contrasts")$a
[1] "contr.treatment"
attr(,"contrasts")$b
[1] "contr.treatment"

> print(model.matrix( ~a + b + a*b, dd , colNames=False))
  (Intercept) a2 b2 b3 a2:b2 a2:b3
1           1  0  0  0     0     0
2           1  0  1  0     0     0
3           1  0  0  1     0     0
4           1  1  0  0     0     0
5           1  1  1  0     1     0
6           1  1  0  1     0     1
attr(,"assign")
[1] 0 1 2 2 3 3
attr(,"contrasts")
attr(,"contrasts")$a
[1] "contr.treatment"
attr(,"contrasts")$b
[1] "contr.treatment"
bgoldst

It is unfortunate that there doesn't seem to be any way to suppress row names when printing matrices, isn't it? One option is to coerce to data.frame and use the row.names argument of print.data.frame():

dd <- data.frame(a=gl(2,3),b=gl(3,1,6));
print(as.data.frame(model.matrix( ~a + b + a*b, dd )),row.names=F);
##  (Intercept) a2 b2 b3 a2:b2 a2:b3
##            1  0  0  0     0     0
##            1  0  1  0     0     0
##            1  0  0  1     0     0
##            1  1  0  0     0     0
##            1  1  1  0     1     0
##            1  1  0  1     0     1

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How can I print the line numbers of gedit?

From Dev

How can I print the line numbers of gedit?

From Dev

How can i print numbers on single line

From Dev

How can I print source code on OS X with line numbers, line-wrapping, margins, formatting?

From Dev

How do I print line numbers but reset line counter at empty line?

From Dev

How can I suppress the addition of a blank new line after the class declaration in IntelliJ? (Code Style)

From Java

How can I print out only odd numbers in an addition loop?

From Dev

How can I print to the console this table of numbers in Java?

From Dev

How can I set a specific set of numbers in an array/matrix to print?

From Dev

How Can I Print Values and Index Numbers of an ArrayList without a Loop?

From Dev

How can I suppress warnings for using '!!' (not not)?

From Dev

How can I suppress warnings in generated code?

From Dev

How can I suppress output of grep?

From Dev

How can I suppress ending newline in write()?

From Dev

How can I suppress unchecked cast warnings?

From Dev

How can I suppress NUnit console output?

From Dev

How can I suppress warnings for using '!!' (not not)?

From Dev

How can I suppress these error messages?

From Dev

How can I print a new line in a toString() method in java

From Dev

How can I print a long line in realtime in python?

From Java

How can I print variable and string on same line in Python?

From Dev

How can i print my array and my histogram on the same line?

From Dev

How can I print all content of an array in one line?

From Dev

c - how can I print specified count of a char in a line

From Dev

How can I print the output of pv each on a new line as it changes?

From Dev

how can I print multiple odt files from the command line?

From Dev

How can I use OptionParser to print to the command line?

From Dev

How can i print a specific amount of characters per line in the console?

From Dev

How can I find the line numbers of a method invocation in Java

Related Related

  1. 1

    How can I print the line numbers of gedit?

  2. 2

    How can I print the line numbers of gedit?

  3. 3

    How can i print numbers on single line

  4. 4

    How can I print source code on OS X with line numbers, line-wrapping, margins, formatting?

  5. 5

    How do I print line numbers but reset line counter at empty line?

  6. 6

    How can I suppress the addition of a blank new line after the class declaration in IntelliJ? (Code Style)

  7. 7

    How can I print out only odd numbers in an addition loop?

  8. 8

    How can I print to the console this table of numbers in Java?

  9. 9

    How can I set a specific set of numbers in an array/matrix to print?

  10. 10

    How Can I Print Values and Index Numbers of an ArrayList without a Loop?

  11. 11

    How can I suppress warnings for using '!!' (not not)?

  12. 12

    How can I suppress warnings in generated code?

  13. 13

    How can I suppress output of grep?

  14. 14

    How can I suppress ending newline in write()?

  15. 15

    How can I suppress unchecked cast warnings?

  16. 16

    How can I suppress NUnit console output?

  17. 17

    How can I suppress warnings for using '!!' (not not)?

  18. 18

    How can I suppress these error messages?

  19. 19

    How can I print a new line in a toString() method in java

  20. 20

    How can I print a long line in realtime in python?

  21. 21

    How can I print variable and string on same line in Python?

  22. 22

    How can i print my array and my histogram on the same line?

  23. 23

    How can I print all content of an array in one line?

  24. 24

    c - how can I print specified count of a char in a line

  25. 25

    How can I print the output of pv each on a new line as it changes?

  26. 26

    how can I print multiple odt files from the command line?

  27. 27

    How can I use OptionParser to print to the command line?

  28. 28

    How can i print a specific amount of characters per line in the console?

  29. 29

    How can I find the line numbers of a method invocation in Java

HotTag

Archive