avoid string printed to console getting truncated (in RStudio)
This is an RStudio-specific feature, intended to help resolve problems where printing overly long strings could cause IDE sluggishness. (I believe it was added with the latest release, v0.99.896)
You can opt-out of this truncation by setting the Limit length of lines displayed in the console to:
option to 0 (see the final option in the dialog):
print entire string to console without truncating and without adjusting a global setting
The short answer is "no" since, the option limiting the print is in the IDE itself, which you can't control from your program itself (I'm assuming you're not some crazy hacker here), and not a language feature. It's like trying to stop "WINDOWS" from doing things (although not).
Seems to me the easiest way (ad hoc) is to turn it on, do whatever, then turn it off. If you insist on not doing that, you need to write your own function:
myprint<- function(somestring,idelimit=100) {
for(i in seq(1,nchar(somestring),idelimit+1)) {
print(substr(somestring,i,i+idelimit));
}
}
I'm not a fluent R coder so let me know if you catch a syntax error. The idea is simple - idelimit
should be wherever studio truncates (I chose 100 arbitrarily), and basically you're doing the splitting yourself so string is printed line after line without truncation. Each time you take a portion at most idelimit
long from somestring
and print it.
list output truncated - How to expand listed variables with str() in R
You can use the argument list.len
:
str(df, list.len=ncol(df))
and if you want to print more observations you could set the argument vec.len
, also have a look at ?str
for documentation of all arguments.
Related Topics
Calculate Cumsum() While Ignoring Na Values
Remove Null Elements from List of Lists
Equivalent to Unix "Less" Command Within R Console
Pass Function Arguments to Both Dplyr and Ggplot
Why Does Merge Result in More Rows Than Original Data
Handling Dates When We Switch to Daylight Savings Time and Back
Why Is Using '<<-' Frowned Upon and How to Avoid It
How to Plot a Stacked and Grouped Bar Chart in Ggplot
Merge by Range in R - Applying Loops
Embedded Nul in String' Error When Importing CSV with Fread
Using Cbind on an Arbitrarily Long List of Objects
Delete "" from CSV Values and Change Column Names When Writing to a CSV
Plot One Numeric Variable Against N Numeric Variables in N Plots
Spread with Duplicate Identifiers (Using Tidyverse and %>%)
Create Frequency Tables for Multiple Factor Columns in R
Filling Area Under Curve Based on Value
How to Subset Data in R Without Losing Na Rows
Adding New Columns to a Data.Table By-Reference Within a Function Not Always Working