A dispaly printing function that trunates data.frame/matrix by adding ellipsis ... to take the place of non-displayed columns and rows.

sotrunc(x, ncol = 10, nrow = 15, ...)

# S3 method for matrix
sotrunc(x, ncol = 10, nrow = 15, ...)

# S3 method for data.frame
sotrunc(x, ncol = 10, nrow = 15, ...)

# S3 method for list
sotrunc(x, ncol = 10, nrow = 15, ...)

# S3 method for default
sotrunc(x, ncol = 10, nrow = 15, ...)

Arguments

x

An R object (usually a data.frame, matrix, or a list that contains >= 1 data.frame/matrix.

ncol

The number of columns (including 3 columns displayed as ellipsis) to display.

nrow

The number of rows (including 3 rows displayed as ellipsis) to display.

...

Other arguments passed to sotrunc.

Value

Prints a truncated display of the input.

Note

This function is intended for truncated display. Please do not use to gernarate your SSCCE (Short, Self Contained, Correct (Compilable), Example).

Examples

sotrunc(mtcars)
#> mpg cyl disp hp drat wt . . . carb #> Mazda RX4 Wag 21.0 6 160.0 110 3.90 2.875 . . . 4 #> Datsun 710 22.8 4 108.0 93 3.85 2.320 . . . 1 #> Hornet 4 Drive 21.4 6 258.0 110 3.08 3.215 . . . 1 #> Hornet Sportabout 18.7 8 360.0 175 3.15 3.440 . . . 2 #> Valiant 18.1 6 225.0 105 2.76 3.460 . . . 1 #> Duster 360 14.3 8 360.0 245 3.21 3.570 . . . 4 #> Merc 240D 24.4 4 146.7 62 3.69 3.190 . . . 2 #> Merc 230 22.8 4 140.8 95 3.92 3.150 . . . 2 #> Merc 280 19.2 6 167.6 123 3.92 3.440 . . . 4 #> Merc 280C 17.8 6 167.6 123 3.92 3.440 . . . 4 #> Merc 450SE 16.4 8 275.8 180 3.07 4.070 . . . 3 #> . #> . #> . #> Volvo 142E 21.4 4 121.0 109 4.11 2.780 . . . 2
sotrunc(mtcars, nrow = 6)
#> mpg cyl disp hp drat wt . . . carb #> Mazda RX4 Wag 21.0 6 160.0 110 3.90 2.875 . . . 4 #> Datsun 710 22.8 4 108.0 93 3.85 2.320 . . . 1 #> . #> . #> . #> Volvo 142E 21.4 4 121.0 109 4.11 2.780 . . . 2
sotrunc(mtcars, ncol = 6)
#> mpg cyl . . . carb #> Mazda RX4 Wag 21.0 6 . . . 4 #> Datsun 710 22.8 4 . . . 1 #> Hornet 4 Drive 21.4 6 . . . 1 #> Hornet Sportabout 18.7 8 . . . 2 #> Valiant 18.1 6 . . . 1 #> Duster 360 14.3 8 . . . 4 #> Merc 240D 24.4 4 . . . 2 #> Merc 230 22.8 4 . . . 2 #> Merc 280 19.2 6 . . . 4 #> Merc 280C 17.8 6 . . . 4 #> Merc 450SE 16.4 8 . . . 3 #> . #> . #> . #> Volvo 142E 21.4 4 . . . 2
sotrunc(CO2)
#> Plant Type Treatment conc uptake #> 2 Qn1 Quebec nonchilled 175 30.4 #> 3 Qn1 Quebec nonchilled 250 34.8 #> 4 Qn1 Quebec nonchilled 350 37.2 #> 5 Qn1 Quebec nonchilled 500 35.3 #> 6 Qn1 Quebec nonchilled 675 39.2 #> 7 Qn1 Quebec nonchilled 1000 39.7 #> 8 Qn2 Quebec nonchilled 95 13.6 #> 9 Qn2 Quebec nonchilled 175 27.3 #> 10 Qn2 Quebec nonchilled 250 37.1 #> 11 Qn2 Quebec nonchilled 350 41.8 #> 12 Qn2 Quebec nonchilled 500 40.6 #> . #> . #> . #> 84 Mc3 Mississippi chilled 1000 19.9
sotrunc(lm(mpg~hp+am, data=mtcars))
#> $coefficients #> (Intercept) hp am #> 26.5849137 -0.0588878 5.2770853 #> #> $residuals #> Mazda RX4 Mazda RX4 Wag Datsun 710 Hornet 4 Drive #> -4.3843407 -4.3843407 -3.5854333 1.2927446 #> Hornet Sportabout Valiant Duster 360 Merc 240D #> 2.4204518 -2.3016944 2.1425981 1.4661301 #> Merc 230 Merc 280 Merc 280C Merc 450SE #> 1.8094276 -0.1417139 -1.5417139 0.4148909 #> Merc 450SL Merc 450SLC Cadillac Fleetwood Lincoln Continental #> 1.3148909 -0.7851091 -4.1129141 -3.5240360 #> Chrysler Imperial Fiat 128 Honda Civic Toyota Corolla #> 1.6592810 4.4245960 1.6001667 5.8657082 #> Toyota Corona Dodge Challenger AMC Javelin Camaro Z28 #> 0.6272032 -2.2517432 -2.5517432 1.1425981 #> Pontiac Firebird Fiat X1-9 Porsche 914-2 Lotus Europa #> 2.9204518 -0.6754040 -0.5032090 5.1923227 #> Ford Pantera L Ferrari Dino Maserati Bora Volvo 142E #> -0.5156190 -1.8566335 2.8654151 -4.0432285 #> #> $effects #> (Intercept) hp am #> -113.6497374 -26.0455922 -14.2209362 1.7568573 2.4493021 -1.8041000 #> #> 1.7027042 2.2516673 2.3739854 0.2353463 -1.1646537 0.4102594 #> #> 1.3102594 -0.7897406 -4.2849541 -3.7630396 1.3198323 5.9973147 #> #> 3.2666343 7.4451232 1.1783684 -2.0554843 -2.3554843 0.7027042 #> #> 2.9493021 0.8973147 0.9021012 6.4503132 -0.2687766 -1.0138163 #> #> 2.6368170 -2.7584526 #> #> $rank #> [1] 3 #> #> $fitted.values #> Mazda RX4 Mazda RX4 Wag Datsun 710 Hornet 4 Drive #> 25.38434 25.38434 26.38543 20.10726 #> Hornet Sportabout Valiant Duster 360 Merc 240D #> 16.27955 20.40169 12.15740 22.93387 #> Merc 230 Merc 280 Merc 280C Merc 450SE #> 20.99057 19.34171 19.34171 15.98511 #> Merc 450SL Merc 450SLC Cadillac Fleetwood Lincoln Continental #> 15.98511 15.98511 14.51291 13.92404 #> Chrysler Imperial Fiat 128 Honda Civic Toyota Corolla #> 13.04072 27.97540 28.79983 28.03429 #> Toyota Corona Dodge Challenger AMC Javelin Camaro Z28 #> 20.87280 17.75174 17.75174 12.15740 #> Pontiac Firebird Fiat X1-9 Porsche 914-2 Lotus Europa #> 16.27955 27.97540 26.50321 25.20768 #> Ford Pantera L Ferrari Dino Maserati Bora Volvo 142E #> 16.31562 21.55663 12.13458 25.44323 #> #> $assign #> [1] 0 1 2 #> #> $qr #> $qr #> (Intercept) hp am #> Mazda RX4 -5.6568542 -829.78980772 -2.29809704 #> Mazda RX4 Wag 0.1767767 381.74189579 -0.67568560 #> Datsun 710 0.1767767 0.12620114 -2.69484674 #> Hornet 4 Drive 0.1767767 0.08166844 -0.21691576 #> Hornet Sportabout 0.1767767 -0.08860368 -0.14797338 #> Valiant 0.1767767 0.09476629 -0.22221902 #> Duster 360 0.1767767 -0.27197365 -0.07372773 #> Merc 240D 0.1767767 0.20740784 -0.26782706 #> Merc 230 0.1767767 0.12096200 -0.23282554 #> Merc 280 0.1767767 0.04761401 -0.20312728 #> Merc 280C 0.1767767 0.04761401 -0.20312728 #> Merc 450SE 0.1767767 -0.10170154 -0.14267012 #> Merc 450SL 0.1767767 -0.10170154 -0.14267012 #> Merc 450SLC 0.1767767 -0.10170154 -0.14267012 #> Cadillac Fleetwood 0.1767767 -0.16719081 -0.11615381 #> Lincoln Continental 0.1767767 -0.19338652 -0.10554729 #> Chrysler Imperial 0.1767767 -0.23268009 -0.08963751 #> Fiat 128 0.1767767 0.19692956 0.10749416 #> Honda Civic 0.1767767 0.23360355 0.09264504 #> Toyota Corolla 0.1767767 0.19954913 0.10643351 #> Toyota Corona 0.1767767 0.11572286 -0.23070424 #> Dodge Challenger 0.1767767 -0.02311440 -0.17448968 #> AMC Javelin 0.1767767 -0.02311440 -0.17448968 #> Camaro Z28 0.1767767 -0.27197365 -0.07372773 #> Pontiac Firebird 0.1767767 -0.08860368 -0.14797338 #> Fiat X1-9 0.1767767 0.19692956 0.10749416 #> Porsche 914-2 0.1767767 0.13144028 0.13401047 #> Lotus Europa 0.1767767 0.07380972 0.15734481 #> Ford Pantera L 0.1767767 -0.32174550 0.31750327 #> Ferrari Dino 0.1767767 -0.08860368 0.22310524 #> Maserati Bora 0.1767767 -0.50773504 0.39280957 #> Volvo 142E 0.1767767 0.08428801 0.15310220 #> attr(,"assign") #> [1] 0 1 2 #> #> $qraux #> [1] 1.176777 1.081668 1.136132 #> #> $pivot #> [1] 1 2 3 #> #> $tol #> [1] 1e-07 #> #> $rank #> [1] 3 #> #> attr(,"class") #> [1] "qr" #> #> $df.residual #> [1] 29 #> #> $xlevels #> named list() #> #> $call #> lm(formula = mpg ~ hp + am, data = mtcars) #> #> $terms #> mpg ~ hp + am #> attr(,"variables") #> list(mpg, hp, am) #> attr(,"factors") #> hp am #> mpg 0 0 #> hp 1 0 #> am 0 1 #> attr(,"term.labels") #> [1] "hp" "am" #> attr(,"order") #> [1] 1 1 #> attr(,"intercept") #> [1] 1 #> attr(,"response") #> [1] 1 #> attr(,".Environment") #> <environment: 0x5579bfac37d8> #> attr(,"predvars") #> list(mpg, hp, am) #> attr(,"dataClasses") #> mpg hp am #> "numeric" "numeric" "numeric" #> #> $model #> mpg hp am #> Mazda RX4 21.0 110 1 #> Mazda RX4 Wag 21.0 110 1 #> Datsun 710 22.8 93 1 #> Hornet 4 Drive 21.4 110 0 #> Hornet Sportabout 18.7 175 0 #> Valiant 18.1 105 0 #> Duster 360 14.3 245 0 #> Merc 240D 24.4 62 0 #> Merc 230 22.8 95 0 #> Merc 280 19.2 123 0 #> Merc 280C 17.8 123 0 #> Merc 450SE 16.4 180 0 #> Merc 450SL 17.3 180 0 #> Merc 450SLC 15.2 180 0 #> Cadillac Fleetwood 10.4 205 0 #> Lincoln Continental 10.4 215 0 #> Chrysler Imperial 14.7 230 0 #> Fiat 128 32.4 66 1 #> Honda Civic 30.4 52 1 #> Toyota Corolla 33.9 65 1 #> Toyota Corona 21.5 97 0 #> Dodge Challenger 15.5 150 0 #> AMC Javelin 15.2 150 0 #> Camaro Z28 13.3 245 0 #> Pontiac Firebird 19.2 175 0 #> Fiat X1-9 27.3 66 1 #> Porsche 914-2 26.0 91 1 #> Lotus Europa 30.4 113 1 #> Ford Pantera L 15.8 264 1 #> Ferrari Dino 19.7 175 1 #> Maserati Bora 15.0 335 1 #> Volvo 142E 21.4 109 1 #>
sotrunc(1:10)
#> [1] 1 2 3 4 5 6 7 8 9 10
sotrunc(mtcars[1:5, 1:5])
#> mpg cyl disp hp drat #> 1 Mazda RX4 21.0 6 160 110 3.90 #> 2 Mazda RX4 Wag 21.0 6 160 110 3.90 #> 3 Datsun 710 22.8 4 108 93 3.85 #> 4 Hornet 4 Drive 21.4 6 258 110 3.08 #> 5 Hornet Sportabout 18.7 8 360 175 3.15