trying to understand why the last line of a script won't produce any output

Trying to run a script on R Studio:

rm(list = ls())
compensation <- read_csv("C:/Users/Rupert/Documents/MyFirstAnalysis/datasets/compensation.csv")

Final line of script seems not to be generating output.

Actual output generated from script is:

Attaching package: 'dplyr'

The following objects are masked from 'package:stats':

filter, lag

The following objects are masked from 'package:base':

intersect, setdiff, setequal, union

Parsed with column specification:
Root = col_double(),
Fruit = col_double(),
Grazing = col_character()
Rows: 40
Columns: 3
Root <dbl> 6.225, 6.487, 4.919, 5.130, 5.417, 5.359, 7.614, 6.352, 4.9... Fruit 59.77, 60.98, 14.73, 19.28, 34.25, 35.53, 87.73, 63.21, 24....
$ Grazing "Ungrazed", "Ungrazed", "Ungrazed", "Ungrazed", "Ungrazed",...

Seems as though second last line of script is producing output but not last line. Why would that be, does anyone know?


Welcome to the RStudio community!

It seems strange that glimpse would work, but summary not. Could you give us a reprex of this issue? A reprex consists of the minimal code and data needed to recreate the issue/question you're having. (we have the code, but no data) You can find instructions how to build and share one here:


Thanks Pieter,

I did a reprex on a small version of the dataset and then the problem is solved, the code runs as is expected, but then when I go back to running the script on the file called "compensation.csv", the problem comes back, when I run the script and look in the "Jobs" frame I see only the output of the glimpse() line but not the summary() line. So I guess I need to work out how to construct a reprex for you that will actually reproduce the problem. It's a relatively small dataset; it is maybe worth my while to try to construct a reprex from the entire dataset to see if that reproduces the issue?


Try and create a reprex indeed. If the data is too large for the reprex, consider uploading it to a repository like GitHub, DropBox etc and share a link for download. You can only do this if your data is not private or sensitive of course! If you can't you'll have to try and generate a random dataset the same shape and size of your original data. Using functions like sample() and runiform() can help with that. Maybe then you can recreate the problem.


The data file I was using is called "compensation.csv", to get it go here

download the zip file, and then while reading the zip file open the folder called "datasets-master", then get the file called compensation.csv from there.

With that together with the code in my first post, does that allow you to re-create the problem for yourself?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.