R Tip: Use drop = FALSE with data.frames

Win-Vector Blog 2018-02-27

Summary:

Another R tip. Get in the habit of using drop = FALSE when indexing (using [ , ] on) data.frames. Prince Rupert’s drops (img: Wikimedia Commons) In R, single column data.frames are often converted to vectors when manipulated. For example: d <- data.frame(x = seq_len(3)) print(d) #> x #> 1 1 #> 2 2 #> … Continue reading R Tip: Use drop = FALSE with data.frames

Link:

http://www.win-vector.com/blog/2018/02/r-tip-use-drop-false-with-data-frames/

From feeds:

Statistics and Visualization » Win-Vector Blog

Tags:

Authors:

John Mount

Date tagged:

02/27/2018, 13:05

Date published:

02/27/2018, 10:09