Open stla opened 1 year ago
That works with capture.output(print_spray_polyform(poly))
.
Hi there, thanks for this, great to hear from you! I've been working on spray
recently and I think that this is a bug in print()
:
library("spray")
#>
#> Attaching package: 'spray'
#> The following objects are masked from 'package:base':
#>
#> pmax, pmin
a <- spray(diag(3))
print(a)
#> val
#> 0 0 1 = 1
#> 0 1 0 = 1
#> 1 0 0 = 1
#> val
#> 0 0 1 = 1
#> 0 1 0 = 1
#> 1 0 0 = 1
Created on 2023-07-03 with reprex v2.0.2
I remember being a bit confused about best practice for print methods and I think I forgot an invisible()
somewhere.
I will raise an issue for the print()
problem separately.
Not 100% sure about the str()
issue. Can you give me a dput()
for the object that gave the inconsistent str()
output please?
> dput(groups)
list(structure(list(index = structure(c(0L, 2L, 1L, 2L, 2L, 2L
), dim = 3:2), value = c(1, 1, -2)), class = "spray"), structure(list(
index = structure(c(2L, 1L, 1L, 1L), dim = c(2L, 2L)), value = c(-2,
2)), class = "spray"), structure(list(index = structure(c(2L,
0L), dim = 1:2), value = 1), class = "spray"), structure(list(
index = structure(c(1L, 0L, 2L, 2L), dim = c(2L, 2L)), value = c(-2,
-2)), class = "spray"))
OK thanks for this, will raise a separate issue for the str()
behaviour.
I didn't show you why I needed as.character.spray
: https://stackoverflow.com/q/76593269/1100107. That might interest you.
Hello,
I have something strange. I have a list of four sprays:
I want to have them as character. Since there's not
as.character.spray
function - and I think it would be nice to have one -, I did my own function:I apply my function to the list:
Every spray is duplicated! Do you have an idea way?
Another strange thing:
Sometimes this print "Class spray hidden list of 2", but not always.