I have a problem on RStudio in my data view, I can see only the first 50 columns for all dataframes. Is it possible to increase the number of view columns?
You can use a "hidden" RStudio option to set the maximum number of columns the viewer will display before switching to the arrows.
This example sets the number to 1000 columns:
rstudioapi::writeRStudioPreference("data_viewer_max_columns", 1000L)
Found in an RStudio developer's comment on a github issue about this topic.
---EDIT---
You can set this value in the Command Palette in RStudio v1.4:
I do not believe you can increase the number of columns to view at a time. But you can click the little arrow at the top to scroll across to more columns.
I'm using RStudio 1.2.1335 and not sure which version of RStudio first implemented this feature.
Related
I'm looking to save a dataframe called chla.output (~100 rows, 2 columns) to a pdf in R/Rstudio. I've been using:
pdf(file = "output.pdf")
grid.table(chla.output)
dev.off()
Unfortunately when I open the pdf it only saves, say, the last 30 rows. I also get the "null device 1" message in the console. I'm sure there's an easy solution using RMarkdown, unfortunately I'm limited to only using base R or Rstudio because of the target audience for the package this is part of.
Thanks!
I don't have your data.frame so I'm using mtcars.
Using the height argument of pdf() you can specify the document height. You want to adjust this value based on the number of rows your data.frame has. Dividing the number of rows by 3 seems to create a value that works well.
pdf(file = "output.pdf", height=nrow(mtcars)/3)
gridExtra::grid.table(mtcars)
dev.off()
I deal with large datasets frequently. Unfortunately, RStudio IDE's environment shows row count of data.frame like 156212811 and it'll be really useful if it shows in readable notation (like 156,212,811).
Is there any way how I can force it to use commas in row count?
Attached screenshot for reference
im trying to find an easy formula to do the following:
=IF(AND(H6="OK";H7="OK";H8="OK";H9="OK";H10="OK";H11="OK";);"OK";"X")
This actually works. But I want to apply to a range of cells within a column (H6:H11) instead of having to create a rule for each and every one of them... But trying as a range:
=IF(AND(H6:H11="OK";);"OK";"X")
Does not work.
Any insights?
Thanks.
=ArrayFormula(IF(AND(H6:H11="OK");"OK";"X"))
also works
arrayformulas work the same way they do in excel... they just need an ArrayFormula() around to work (will be automatically set when pressing Ctrl+Alt+Return like in excel)
In google sheets the formula is:
=ArrayFormula(IF(SUM(IF(H6:H11="OK";1;0))=6;"OK";"X"))
in excel:
=IF(SUM(IF(H6:H11="OK";1;0))=6;"OK";"X")
And confirm with Ctrl-Shift-Enter
This basically counts the number of times the said range is = to the criteria and compares it to the number it should be. So if the range is increased then increase the number 6 to accommodate.
I'd like to hear how one could bypass the default View() options. In my computer it only shows up to 100 columns. I'd like it to about 400 columns. It's possible?
Meanwhile, you can use the utils::View() to view more columns of the data. This isn't quite as useful or pretty as the RStudio Viewer but it does a decent job on tables with more than 100 columns.
The other option that I occasionally use is View(df[,101:200]) etc. to view different columns of the data--sometimes this can be combined with some columns at the beginning so that I can see the necessary key data.
I am inspecting research data from NIR spectroscopy. Unfortunately, the output is too big (2048 rows with 15 columns).
Very often, when I try to check a variable like mymodel$loadings my results get truncated.
I understand that I can increase the max output of my terminal, but it's really a hassle to scroll my mouse up from my terminal window. Is there a way I can tell R to pipe the output from my last statement to less or more so I can just scroll using the keyboard?
Are you using a version of RStudio? I would generally look at tables like this in the Data Viewer pane, it allows you to see all data in tables like yours a lot easier.
Access by clicking on the data frame name in top right, or using below in console:
View(dataframe_name)