Git Product home page Git Product logo

sparktable's People

Contributors

alexkowa avatar bernhard-da avatar lianos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sparktable's Issues

Error when exporting newSparkHist object

There is an error when exporting newSparkHist object. For example:

 library(sparkTable)
 v1 <- as.numeric(table(rpois(50, 2))); v2 <- rnorm(50)
 shist <- newSparkHist(values = v2, barCol = c("black", "darkgreen", "black"))
 export(object = shist, outputType = "pdf",filename = file.path("figures", "first-hist"))
Error: Unknown parameters: binwidth, bins, pad

I guess this is related to a change in ggplot2; see the issue below:
tidyverse/ggplot2#1465

Create new spark object and modify appearance at same time

Would it be possible to modify new spark objects arguments when creating a spark object?
For example it is possible to modify the line thickness of a sparkline:

 sparkline <- newSparkLine(values = rlnorm(100), lineWidth = 1)
 plot(sparkline)

But to modify outlier colour of a sparkbox you have to use setParameter

sparkbox <- newSparkBox(values = rlnorm(100))
sparkbox <- setParameter(sparkbox, "red", type = "outCol")
plot(sparkbox)

A consistent approach might be:

sparkbox <- newSparkBox(values = rlnorm(100), boxOutCol = "red")
plot(sparkbox)

Error: could not find function "pixmapGrob"

Not sure this is still in gridExtra?

library(sparkTable)

dirflags = paste(searchpaths()[grep("sparkTable", searchpaths())], "/etc/Flaggen/",
                 sep="")
### EXAMPLE for EUROPE
data(EU_data)
order_eu = optimal_grid_allocation(EU_data[,16:17],8,7)
colnames(EU_data)[1] <- c("country")
EU_data[,18] <- order_eu
colnames(EU_data)[1] <- c("country")
colnames(EU_data)[18] <- c("order")
data_eu = data.frame(cbind(rep(1997,34)), EU_data$unempl_f_1997, EU_data$country,
                     EU_data$order)
colnames(data_eu) = c("x", "y", "names", "order")
for(year in 1998:2008){
  XX <- data.frame(cbind(rep(year,34)), EU_data[,paste("unempl_f_",year,sep="")],
                   EU_data$country, EU_data$order)
  colnames(XX) = c("x", "y", "names", "order")
  data_eu = rbind(data_eu,XX)
}
dirflags_eu=paste(dirflags,"EU/",sep="")
checkerplot(data_eu, cols=8, rows=7, geom="line", img=dirflags_eu,
            title = "Unemployment rate in Europe 1997 to 2008 (in perc)", title.size=18,
            ylabels=c(5,10,15,20),
            ybreaks=c(5,10,15,20), xbreaks=c(1998,2001,2004,2007),
            xlabels=c("98","01","04","07"),
            margin_yaxis=-0.05, margin_yaxis2=-0.2,
            margin_xaxis=-0.4, margin_xaxis2=0 )

#Error: could not find function "pixmapGrob"

shiny apps dont work anymore

Probably due to the latest shiny package update, the shiny apps showSparkTable and customizeSparkTable dont work anymore...!?

Issue with ggplot2

Hi,

I think there might be an issue with ggplot 2.2.0. This simple Knitr example produces the error below with ggplot 2.2.0 but not 2.1.0.

library(sparkTable)

sl <- newSparkLine(values = rnorm(25),  lineWidth = .18,  pointWidth = .4,
width = .4, height = .08)

export(sl, outputType = "png", filename = "sparkLine")
Error in theme(legend.position = "none", line = element_blank(), text = element_blank(), : formal argument "axis.ticks" matched by multiple actual arguments
6.
theme(legend.position = "none", line = element_blank(), text = element_blank(), title = element_blank(), axis.line = element_blank(), axis.ticks = element_blank(), legend.background = element_rect(fill = "white", colour = NA), plot.background = element_blank(), strip.background = element_rect(fill = "white", ...
5.
plot(.Object, ...)
4.
plot(.Object, ...)
3.
.local(object, ...)
2.
export(sl, outputType = "png", filename = "sparkLine")
1.
export(sl, outputType = "png", filename = "sparkLine")

Issue with Latex Output

I want to use sparkTables within an R Markdown document - I found this package and it looks great, so I started to work on my report. Here is the example I used within the markdown file itself:

library(sparkTable)
data(AT_Soccer, package = "sparkTable")
content <- list(function(x) { sum(x) }, function(x) { round(sum(x), 2) }, function(x) { round(sum(x), 2) }, newSparkLine(lineWidth = 2, pointWidth = 6), newSparkBar())
names(content) <- c("Points", "ShotGoal", "GetGoal", "GoalDiff", "WinLose")
vars <- c("points", "shotgoal", "getgoal", "goaldiff", "wl")
stab <- newSparkTable(dataObj = AT_Soccer, tableContent = content, varType = vars)
export(stab, outputType = "tex", filename = "W:/Projects/R/Scripts/OHMR/Report Components/Markdown Files/sparkTable/first-stab", graphNames = "W:/Projects/R/Scripts/OHMR/Report Components/Markdown Files/sparkTable/first-stab", infonote=FALSE, scaleByCol=TRUE)

The last command "export" of course creates the .tex file along with all the graphics in their own PDF files. Great! Now, I notice that export command also generates output - I had to play the with r code chunk options a bit to get the # symbols out of there, but the "results='asis' seemed to do that. Now, I get an error when the markdown tries to render the LaTex syntax. I dug into it a bit, and I see the following:

\begin{table}[ht]
\centering
\begin{tabular}{rlllll}
\hline
& Points & ShotGoal & GetGoal & GoalDiff & WinLose \
\hline
Rapid & $62$ & $63$ & $40$ & \graph{1}{1}{W:/Projects/R/Scripts/OHMR/Report Components/Markdown Files/sparkTable/first-stab4-1} & \graph{1}{1}{W:/Projects/R/Scripts/OHMR/Report Components/Markdown Files/sparkTable/first-stab5-1} \
Salzburg & $80$ & $110$ & $35$ & \graph{1}{1}{W:/Projects/R/Scripts/OHMR/Report Components/Markdown Files/sparkTable/first-stab4-2} & \graph{1}{1}{W:/Projects/R/Scripts/OHMR/Report Components/Markdown Files/sparkTable/first-stab5-2} \
Austria & $53$ & $58$ & $44$ & \graph{1}{1}{W:/Projects/R/Scripts/OHMR/Report Components/Markdown Files/sparkTable/first-stab4-3} & \graph{1}{1}{W:/Projects/R/Scripts/OHMR/Report Components/Markdown Files/sparkTable/first-stab5-3} \
Sturm & $48$ & $55$ & $56$ & \graph{1}{1}{W:/Projects/R/Scripts/OHMR/Report Components/Markdown Files/sparkTable/first-stab4-4} & \graph{1}{1}{W:/Projects/R/Scripts/OHMR/Report Components/Markdown Files/sparkTable/first-stab5-4} \
Groedig & $54$ & $68$ & $71$ & \graph{1}{1}{W:/Projects/R/Scripts/OHMR/Report Components/Markdown Files/sparkTable/first-stab4-5} & \graph{1}{1}{W:/Projects/R/Scripts/OHMR/Report Components/Markdown Files/sparkTable/first-stab5-5} \
Neustadt & $39$ & $43$ & $84$ & \graph{1}{1}{W:/Projects/R/Scripts/OHMR/Report Components/Markdown Files/sparkTable/first-stab4-6} & \graph{1}{1}{W:/Projects/R/Scripts/OHMR/Report Components/Markdown Files/sparkTable/first-stab5-6} \
FC Wacker & $29$ & $42$ & $70$ & \graph{1}{1}{W:/Projects/R/Scripts/OHMR/Report Components/Markdown Files/sparkTable/first-stab4-7} & \graph{1}{1}{W:/Projects/R/Scripts/OHMR/Report Components/Markdown Files/sparkTable/first-stab5-7} \
Wolfsberg & $41$ & $51$ & $63$ & \graph{1}{1}{W:/Projects/R/Scripts/OHMR/Report Components/Markdown Files/sparkTable/first-stab4-8} & \graph{1}{1}{W:/Projects/R/Scripts/OHMR/Report Components/Markdown Files/sparkTable/first-stab5-8} \
Ried & $43$ & $55$ & $66$ & \graph{1}{1}{W:/Projects/R/Scripts/OHMR/Report Components/Markdown Files/sparkTable/first-stab4-9} & \graph{1}{1}{W:/Projects/R/Scripts/OHMR/Report Components/Markdown Files/sparkTable/first-stab5-9} \
Admira & $42$ & $51$ & $67$ & \graph{1}{1}{W:/Projects/R/Scripts/OHMR/Report Components/Markdown Files/sparkTable/first-stab4-10} & \graph{1}{1}{W:/Projects/R/Scripts/OHMR/Report Components/Markdown Files/sparkTable/first-stab5-10} \
\hline
\end{tabular}
\end{table}

After studying it a bit, I notice the files in the paths above do not have the ".pdf" on the end. On a hunch that might be the issue, I fire up TeXworks (part of the MikTeX software) and try to generate a PDF - I get an error in there too, so I append ".pdf" on to the end of each file name and , voila! It works. So somehow the sparkTable export command isn't appending the .pdf on to the end of the file names when it generates the LaTex. I search through all of the documentation, figuring there must be some option to do that, but I don't see one. If I add ".pdf" to the end of the file in the export command, I just get a file called "first-stab4-10.pdf.pdf" - not what I want. I'm sure this is simple, but I wonder if this may be a bug somehow in the package. Can you help me with this? Thanks so much!

ggplo2

cr.plot<-nakedMap(cr, title="Cropped")

Error in theme(line = element_blank(), line = element_blank(), axis.text = element_blank(), :
formal argument "line" matched by multiple actual arguments

I got this error when I am plotting raster data.

can't use sparkTable because of proxy working from R 3.4

I'm stuck with an older version of R (3.3.1) and sparkTable depends on proxy which is available only from 3.4. Is a hard dependency on proxy absolutely necessary ?

Package description says :

Provides an extensible framework for the efficient calculation of auto- and crossproximities,
along with implementations of the most popular ones.

Which seems like something that might not be necessary for sparkTable's basic features ?

Is there a way for me to hack my way round it ? I'd love to make use of sparkTable.

plotSparkTable() no longer exists?

Hi, I am using this manual for SparkTable package: https://web.warwick.ac.uk/statsdept/user2011/TalkSlides/Contributed/18Aug_0950_FocusVI_4-ReportingData_2-Kowarik.pdf and it tells me there are functions like plotSparkLine, plotSparkTable etc. but they have all disappeared? What are the alternatives??

When I tried to use plot() on a sparktable, it gave me an error

Error in as.double(y) :
cannot coerce type 'S4' to vector of type 'double'

What's happening??????

Background color for newSparkBar

Thank you very much for your work!
Would it be possible to add a background color option to newSparkBar? It could be a fourth parameter to barCol, preferably with the "transparent" option that there already exists for the newSparkLine. That would be really helpful for me, since I color every second row of my table and the white background does not look good.

reshapeExt breaks on R v3.4 +

I have some existing code to create a sparkTable that worked in R v3.3. When I upgraded to 3.5, I was getting an error in the reshapeExt to prepare the sparkTable objects. I tracked it back and the internal call to reshape is generating the error. It can be seen with this code:

testdf <- data.frame(type = c("A", "A", "A", "B", "B", "B"),
                     rank = c(1, 2, 3, 1, 2, 3),
                     val1 = c(2, 5, 7, 2, 8, 5),
                     val2 = c(3, 8, 6, 7, 3, 4))

testdflong <- reshape(testdf,
                      idvar = "type",
                      timevar = "rank",
                      varying = list(3,4),
                      direction = "long")

testdflong <- reshapeExt(testdf,
                      idvar = "type",
                      timevar = "rank",
                      varying = list(3,4))

which generates the error:

Error in row.names<-.data.frame(*tmp*, value = paste(ids, times[i], :
duplicate 'row.names' are not allowed
In addition: Warning message:
non-unique values when setting 'row.names': ‘A.1’, ‘B.1’

Checking with various friends, this error is generated from v3.4 (Windows and Mac). In the event, I got round the problem by simply adding the attributes to the dataframe so that it registered as being in long format for the purposes of sparkTable.

boxShowOut argument of newSparkPlot seems not to function

boxShowOut is a function for newSParkBox - 'logical vector specifying if outliers should be displayed in spark boxplots'

This argument is not described in setParameter and there seems to be no guidance on how the argument should be used in the package documentation.

I would have expected the argument to work like this:

sparkbox <- newSparkBox(values = rlnorm(100), boxShowOut = FALSE)

or possibly:

sparkbox <- newSparkBox(values = rlnorm(100))
sparkbox <- setParameter(sparkbox, FALSE, type = "showOut")
plot(sparkbox)

Neither case works. I get the following error message:

Error in (function (cl, name, valueClass)  : 
‘boxShowOut’ is not a slot in class “sparkbox”

My workround is to use the boxOutCol argument to make the outlier colour the same as the box backgound colour. Using the boxShowOut would be more correct.

Request for package enhancement: ability to modify sparkBox outlier point width

It is possible to modify the width of the points used on a sparkLine

sparkline <- newSparkLine(values = rlnorm(50), pointWidth = 5)
plot(sparkline)


It would be really useful to be able to adjust the point width of the boxplot outliers so that a pleasing visual balance between the boxplot and the outliers can be achieved.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.