Why R shows output without using full column names?

Hello,
I came across that without using the full name, outputs are shown in R.
For example, the following dataframe.

dat=data.frame(
  column1=seq(1:10),
  nolumn12=runif(10)
)
dat
dat$n
dat$col

OUtput:

> dat=data.frame(
+   column1=seq(1:10),
+   nolumn12=runif(10)
+ )
> 
> dat$n
 [1] 0.364771754 0.372681924 0.128495624 0.953522193
 [5] 0.115461037 0.001983741 0.317312683 0.733074472
 [9] 0.027663035 0.013777922
> 
> dat$col
 [1]  1  2  3  4  5  6  7  8  9 10

Is it possible not to show output unless the proper column names are provided?

Thank you

This is a feature of base R.

Use a tibble to change this behaviour.

1 Like

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.