I am trying to find the unique combinations of origin and dest in R editor. However, the output is not showing the rows number. This is the expected output.
# Find all unique origin and destination pairs
flights |>
distinct(origin, dest)
#> # A tibble: 224 × 2
#> origin dest
#> <chr> <chr>
#> 1 EWR IAH
#> 2 LGA IAH
#> 3 JFK MIA
#> 4 JFK BQN
#> 5 LGA ATL
#> 6 EWR ORD
#> # ℹ 218 more rows
R Editor showing less rows
R Editor showing less rows
- Attachments
-
- flights.csv
- (4.34 KiB) Downloaded 19 times
-
- Untitled.png (89.13 KiB) Viewed 2120 times
Re: R Editor showing less rows
Hey @srk80,
In jamovi's Rj Editor, when a script evaluates to a data.frame (or tibble), Rj automatically renders the output as an interactive jamovi table instead of raw console text.
This is why it displays formatted rows rather than the standard console header (# A tibble: 224 × 2, <chr>, etc.).
Depending on what output you need, here are the solutions:
If you want to force Rj to show the text printout (including row counts and data types) as seen in RStudio, convert data to a tibble and wrap the expression in print():
If you simply want to return the total number of unique origin-destination pairs:
If you want to see each unique combination along with how many times it appears:
Cheers,
Maurizio
https://www.jamovi.org/about.html
In jamovi's Rj Editor, when a script evaluates to a data.frame (or tibble), Rj automatically renders the output as an interactive jamovi table instead of raw console text.
This is why it displays formatted rows rather than the standard console header (# A tibble: 224 × 2, <chr>, etc.).
Depending on what output you need, here are the solutions:
If you want to force Rj to show the text printout (including row counts and data types) as seen in RStudio, convert data to a tibble and wrap the expression in print():
Code: Select all
library(dplyr)
# Print as a tibble to force R console text formatting
print(as_tibble(distinct(data, origin, dest)))Code: Select all
library(dplyr)
# Return the exact number of unique rows
data |>
distinct(origin, dest) |>
nrow()Code: Select all
library(dplyr)
# Count occurrences per pair
data |>
count(origin, dest)Maurizio
https://www.jamovi.org/about.html
Re: R Editor showing less rows
As this functionality is an important one, can you integrate this option in jamovi instead of using R? It is really helpful and avoids the use of native R.