Misaligned columns in rstudio when viewing dataframe - r

When viewing dataframes in the "Source" section of RStudio, the columns are frequently misaligned, making it difficult to read.
I'm not sure what is causing this, and playing around with the width of the columns doesn't seem to help. I've looked at the "known issue" of column misalignment, but as far as I could tell, it seemed to be a different error. I'm not sure if this is due to something in my settings, but nothing there seems to apply, and restarting RStudio doesn't do anything either.
This happens when clicking on the object in the Data section of the environment, which prints:
View(cps_tiers
At this point, the dataframe loads fine, but the columns are hard to read. Here is an image of what I'm describing:

Calum You was correct, I updated RStudio and the issue seems to have gone away. Thanks for the help!

Related

ggplot refuses to forget loop of plots from my previous project

I have no idea what's going on, I never got this problem before, but I'm working on a new project and whenever I try to call grid.arrange or any kind of plot now in a loop of plots, R displays the plots from my last project which I obviously don't want anymore which is the last time I used grid.arrange. It refuses to display all of the plots together and I have to go through all of them one by one. It doesn't make sense since my computer has turned off and logged on with new updates since the last time I was working on that project. I tried rm=ls() and I still get the same problem. Help :/
the function is rm(list=ls()). You could also try file.remove(".RData") in the working directory.

R pasteing data errors

I'm pulling my hair out because I need data sets input into R for a test but some of them are just too big to input by hand like i've been getting away with up until now. Every time I try and paste one of the teacher's data sets it shows up in error below each row. It doesn't do this for my friend on his mac (I have windows) and I have tried deleting and redownloading, even from another server! I've also tried imputing the data in excel first and that didn't work either. please help, I don't know what I can do differently.
data set from web
errors in R

R viewer off kilter and slow

I'm trying to look at some data in RStudio using View(). Code is running smoothly, but for some reason the display looks kind of off. Column labels are a little off from the rest of the column. See image here or below: https://ibb.co/gTJFCj0
Scrolling is also incredibly slow. It takes close to 5 seconds for it to respond at all.
I'm new to R, so I have absolutely no clue where to even begin looking. I'm guessing it may be that RStudio is trying to display everything at once?

Using R with tidyquant and massiv data

While working with R I encountered a strange problem:
I am processing date in the follwing manner:
Reading data from a database into a dataframe, filling missing values, grouping and nesting the data to a combined primary key, creating a timeseries and forecastting it for every group, ungroup and clean the data, write it back into the DB.
Somehting like this:
https://cran.rstudio.com/web/packages/sweep/vignettes/SW01_Forecasting_Time_Series_Groups.html
For small data sets this works like a charm, but with lager ones (over about 100000 entries) I do get the "R Session Aborted" screen from R-Studio and the nativ R GUI just stops execution and implodes.
There is no information in every log file that I've look into. I suspect that it is some kind of (leaking) memory issue.
As a work around I'm processing the data in chunks with a for-loop. But no matter how small the chunk size is, I do get the "R Session Aborted" screen, which looks a lot like leaking memory.
The whole date consist of about 5 million rows.
I've looked a lot into packages like ff, the big-Family and matter basically everything from https://cran.r-project.org/web/views/HighPerformanceComputing.html
but this dose not seem to work well with tibbles and the tidyverse way of data processing.
So, how can I improve my scrip to work with massiv amounts of data?
How can I gather clues about why the R Session is Aborted?
Check out the article at:
datascience.la/dplyr-and-a-very-basic-benchmark
There is a table that shows runtime comparisons for some of the data wrangling tasks you are performing. From the table, it looks as though dplyr with data.table behind it is likely going to do much better than dplyr with a dataframe behind it.
There’s a link to the benchmarking code used to make the table, too.
In short, try adding a key, and try using data.table over dataframe.
To make x your key, and say your data.table is named dt, use setkey(dt,x).
While Pakes answer deals with the described problem I found a solution to the underlying problem. For Compatibility reason I used R in the 3.4.3 version. Now I'm using the newer 3.5.1 version which works quite fine.

Conditionally formatting tables using gridExtra in R

Recently I was exposed to the grid.table function in the package gridExtra in R. I am simply looking to make my dataframes look "better" than simply printing them to the console.
The default settings work pretty well, but now I am getting greedy. I am asking for help because I am not sure if the following two formatting settings are possible. I read the documentation but am still not sure if this can happen...
Conditionally format/highlight rows and columns if they meet a certain criteria. My thinking was that I could highlight a certain row to make it stand out from the rest of the table.
Is it possible to left alight the first column in the table and center align everything else?
In short, I really like how easy it is to format a dataframe as a table, but now I am hoping I can do a few extra formatting techniques to get the tables to where I need them to be.
Having just emailed Baptiste the author of gridExtra, that functionality is not currently available.
However, he says that once the gtable package is officially released he is planning to make an update to grid.table which should make it easier to customise the output. But also says not to "hold your breath"...He also however suggested to feel free to use the source code and adapt it.
But I too have been looking for ways to highlight rows in tables and have used the package dprint to do so. Hope that helps.

Resources