'CSV export gets ruined, rows become columns
Here is my data
And this is my SSRS report. It is a table with no groupings, just showing the 3 colums. I right clicked on me detail colum and insert row -> inside group - below. I created row 6,7 and 8 because I use the SWITCH function to do some calculations to get the totals.
Now the issue is that the report renders good when I run it. But when I export to CSV, it looks like this:
The rows that I insert, they show up as columns and so my export gets ruined. How can I export them correctly?
Solution 1:[1]
You can try this. The . has to be escaped, otherwise it stands for any character.
!grepl("\\.g",df1$'134518d.g6')
[1] TRUE FALSE FALSE TRUE
# and then use it on the data
df1[!grepl("\\.g",df1$'134518d.g6'),]
# A tibble: 2 x 1
`134518d.g6`
<chr>
1 134519dg6
2 134522dg6
Solution 2:[2]
We could use str_detect from stringr package and negate (!) filter for pattern with escaping . with \\:
library(dplyr)
library(stringr)
df %>%
filter(!str_detect(`134518d.g6`, '\\.g6'))
`134518d.g6`
<chr>
1 134519dg6
2 134522dg6
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | TarJae |



