- #1
- 2,168
- 193
I have data like
and my code is
my output is
but what I want is
so how can I format my output..?
Code:
-418 -26066 -539 -33810
-763 -47745 207 12395
-701 14732 473 -8748
862 -19061 744 -16347
680 59377 -637 -53885
-720 35840 -486 23906
-147 3505 762 -20129
677 -53800 849 -67388
-690 42730 995 -63425
203 -4108 620 -11614
93 -6381 26 -1423
-230 -6255 135 3600
498 -8020 341 -5665
855 -35988 306 -12381
69 -4017 -329 17475
and my code is
Code:
library(data.table)
x1 <- Problem10_data$V1
y1 <- Problem10_data$V2
x2 <- Problem10_data$V3
y2 <- Problem10_data$V4
a = (y2 - y1) / (x2 - x1)
b = (x2*y1 - x1*y2) / (x2 - x1)
points <- transpose(data.frame(a = a, b = b))
for (var in points){
cat('(', var, ')', sep = " ")
}
my output is
Code:
( 64 686 )( 62 -439 )( -20 712 )...
but what I want is
Code:
(64 686) (62 -439) (-20 712)
so how can I format my output..?