When I print pattern program in r ,
char<-c("#","@")
m<- matrix(paste(char[1]),nrow =4, ncol = 4)
print(m)
My output is
[,1] [,2] [,3] [,4]
[1,] "#" "#" "#" "#"
[2,] "#" "#" "#" "#"
[3,] "#" "#" "#" "#"
[4,] "#" "#" "#" "#"
But my desired output is # without quotations. I tried char method, I tried vector and I tried noquote
function. But none worked for me. If anyone knows the solution, help me to solve.
The double quotes are not actually part of the data and is just how the output is rendered by R; however, if you knew that already and are asking how to print it without the double quotes then use noquote
noquote(m)
giving:
[,1] [,2] [,3] [,4]
[1,] # # # #
[2,] # # # #
[3,] # # # #
[4,] # # # #
Also print
has a quote=FALSE
argument giving the same output:
print(m, quote = FALSE)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.