Technology Tales

Notes drawn from experiences in consumer and enterprise technology

17:17, 28th November 2020

How to get rid of page numbers in TeX/LaTeX

Removing page numbers in LaTeX documents can be achieved through several methods depending on the document structure and class used. The nopageno package allows \pagestyle{plain} to function like \pagestyle{empty}, suppressing numbering in simple cases, though it does not affect documents using non-plain styles.

For targeted suppression, \pagestyle{empty} or \thispagestyle{empty} can be applied to specific sections or pages, though these may not override page styles set by commands like \maketitle or \chapter. Custom solutions exist for classes such as KOMA-script and memoir, which offer dedicated page style configurations for special pages. The \pagenumbering{gobble} command prevents page numbers from being printed entirely but resets the counter, making it suitable only for initial use. Additionally, the scrpage2 package provides a method to suppress numbers by redefining \pagemark, though this requires the use of \pagestyle{plain} to be effective.

20:24, 20th October 2020

Debugging SASUSER issues when you use SAS software

Users of SAS software may occasionally encounter problems with the SASUSER directory, typically caused by corrupted or outdated catalogs and item stores. Common issues include warning messages about SASUSER.TEMPLAT not being a valid item store, SAS being unable to open the SASUSER.PROFILE catalog or SASUSER.REGSTRY item store, errors when using the Output Delivery System or generating graphics output and read-only access to the SASUSER directory.

Many of these problems can be resolved by first identifying the SASUSER directory location using the PROC OPTIONS command, closing all active SAS sessions and then renaming the problematic files with an unrecognised file extension, prompting SAS to generate fresh, uncorrupted versions upon restart. Where multiple sessions are running simultaneously, only the first session will have update access, so consolidating to a single session is advisable before attempting further troubleshooting.

In multi-user or grid computing environments, the RSASUSER system option may be enforcing read-only access by policy, in which case programmes and processes should be adjusted to avoid relying on SASUSER for personal content, though in local or private environments the option can be changed to NORSASUSER within the SAS configuration file.

14:08, 14th October 2020

Fedora Packages of R Software

R can be installed on Fedora, CentOS and RHEL systems through a meta-package that pulls in several components covering core runtime files, development headers and Java support, with EPEL providing compatible packages for enterprise Linux distributions. The installation is organised across multiple directories separating binaries, libraries and documentation, and users can install additional packages either from official repositories or through the cran2copr project, which maintains automated daily synchronisations of over 20,000 CRAN packages via Fedora Copr.

Since Fedora 33, R has been linked against FlexiBLAS, a wrapper library that allows runtime switching between optimised BLAS and LAPACK backends without leaving an R session, with OpenBLAS set as the default. Development environments including RStudio Desktop and Server are available through a dedicated Copr repository, alongside graphical front-ends and Emacs integration from official repositories.

Containerised development is supported through both official Fedora Docker images and Toolbox, the latter allowing rootless environments, useful for testing new R releases or keeping development separate from the base system. Issues with packages can be reported through the R-SIG-Fedora mailing list or the relevant GitHub repositories, and the overall Fedora R stack is maintained by a number of contributors.

10:43, 4th October 2020

Advanced ODS Graphics: A deeper dive into item stores

Modifying ODS templates in SAS is a task that involves exporting the original code to a file, editing it to suit specific needs and recompiling it. This process allows users to customise graphical outputs without altering the original templates stored in SAS libraries. For instance, adjusting a Kaplan-Meier plot to display percentages instead of proportions requires deleting the existing template, exporting its source code and modifying parameters such as axis labels, tick values and expressions within the template. Temporary files are often used to store edited templates, ensuring that changes are isolated and do not interfere with the original system templates. This approach enables precise control over visual elements while maintaining the integrity of the underlying data and procedures. The key to successful modification lies in thoroughly reviewing the original template code before making changes, ensuring that edits align with the syntax and structure of the template language.

13:44, 13th July 2020

Code Maven: Groovy

A collection of Groovy programming resources has been migrated from Code Maven, covering a broad range of topics for those learning or working with the language. The material spans foundational concepts such as variables, functions, scope and classes, as well as more practical subjects including file handling, regular expressions, JSON processing, date and time management, exception handling and working with maps and lists. Supplementary slide-based content is also available, addressing reasons to use Groovy, available resources, installation and core language features such as input and output operations.

10:25, 29th June 2020

Groovy Goodness: Removing Elements From a Collection

Groovy extends Java's collection classes with several methods for removing elements. The removeAll method accepts a closure defining a condition, and any elements meeting that condition are removed directly from the collection. The removeIf method, introduced in Java 8, works similarly using a predicate that can be expressed as a closure in Groovy. To remove multiple elements at once, removeAll can also accept an array of objects. The removeElement method was added to resolve ambiguity with the standard remove method, which accepts either an object or an integer index value, causing confusion when working with collections of integers. For lists, the removeAt method allows removal of an element at a specified index position. As an alternative to these removal methods, the retainAll method takes the opposite approach, keeping only the elements that satisfy a given condition or match a provided array of objects, and removing everything else from the collection.

12:32, 25th February 2020

Converting Numeric Data to Categories in R

The process of categorising data involves several approaches, each suited to different analytical needs. One method divides data into groups based on quantiles, such as Lower_third, Middle_third and Upper_third, which are determined by percentile thresholds. This technique ensures even distribution across categories, though it may not always reflect underlying patterns in the data. Another approach uses clustering algorithms, such as partitioning around medoids (PAM), to group observations based on similarity across multiple variables.

This method identifies natural groupings within the data, which can reveal hidden structures not apparent through quantile-based methods. For instance, in an example involving two variables, Happy and Tired, clustering revealed four distinct groups, each with unique characteristics. The results of these methods are typically summarised in tables, showing group assignments and associated observations. Visualisation tools like ggplot2 are then used to represent these groupings graphically, providing an intuitive understanding of the data's structure. Each method has its strengths, and the choice depends on the specific goals of the analysis and the nature of the data being examined.

12:31, 25th February 2020

Tables with labels in R

The expss package for R enables users to compute and display cross-tabulation tables with support for labelled variables, multiple and nested banners, weights, multiple-response variables and significance testing, with output rendered in HTML for use in knitr, R notebooks and Jupyter notebooks.

Drawing on functions familiar to users of SPSS and Excel, such as RECODE, COUNT and VLOOKUP, the package is designed to ease the transition of data processing workflows into R. Table construction follows a pipeline approach using the magrittr pipe operator, chaining functions that specify variables, calculate statistics and finalise output, with optional steps for sorting, transposing and dropping empty rows or columns.

The package supports a wide range of statistical outputs including column, row and table percentages, means, standard deviations and custom summary functions, as well as significance testing for both means and proportions. A practical demonstration using a product testing survey illustrates how multiple-response variables can be recoded, labelled and analysed across demographic and preference subgroups, with results exportable as CSV files accompanied by either R labelling code or SPSS syntax.

11:26, 25th February 2020

How to add a column to a dataframe in R

Adding a new column to a dataframe in R can be achieved through two main approaches. The preferred method uses the mutate() function from the dplyr package, which forms part of the broader Tidyverse collection of R packages. To use it, the function takes the name of the dataframe as its first argument, followed by a name-value pair that defines the new variable and how its values should be calculated. The alternative approach uses base R, employing the dollar sign operator to reference and create a new column by assigning a vector of values to it.

While both methods work, the Tidyverse approach is generally considered superior because its functions are intuitively named, easy to learn and straightforward to debug. The Tidyverse also includes other useful packages such as ggplot2 for visualisation, tidyr for reshaping data and stringr for handling string data, making it a comprehensive toolkit for data science in R. One important practical consideration when using mutate() is that it does not modify the original dataframe directly but instead produces a new one, meaning the output must be explicitly assigned to a variable name in order to retain the changes.

11:16, 25th February 2020

4 data wrangling tasks in R for advanced beginners

Here are four core data manipulation tasks: adding columns to existing data frames, generating summaries by data subgroups, sorting results and reshaping data between wide and long formats. Using a sample dataset of revenue and profit figures for Apple, Google and Microsoft from 2010 to 2012, the guide walks through multiple approaches for each task, ranging from base R syntax such as apply() and transform() to the more readable and efficient functions offered by the tidyverse ecosystem, particularly dplyr and tidyr. For adding columns, five distinct methods are demonstrated, with the dplyr mutate() function highlighted as the most elegant option. Grouping and summarising data by category is handled through dplyr's group_by() and summarise() functions, while sorting is made considerably more readable using dplyr's arrange() function compared to base R's order() approach. The final section addresses the conceptually challenging but practically important task of reshaping data, explaining the distinction between wide and long formats and demonstrating how tidyr's newer pivot_longer() and pivot_wider() functions can be used to switch between the two, which is particularly useful when preparing data for visualisation tools such as ggplot2.

  • The content, images, and materials on this website are protected by copyright law and may not be reproduced, distributed, transmitted, displayed, or published in any form without the prior written permission of the copyright holder. All trademarks, logos, and brand names mentioned on this website are the property of their respective owners. Unauthorised use or duplication of these materials may violate copyright, trademark and other applicable laws, and could result in criminal or civil penalties.

  • All comments on this website are moderated and should contribute meaningfully to the discussion. We welcome diverse viewpoints expressed respectfully, but reserve the right to remove any comments containing hate speech, profanity, personal attacks, spam, promotional content or other inappropriate material without notice. Please note that comment moderation may take up to 24 hours, and that repeatedly violating these guidelines may result in being banned from future participation.

  • By submitting a comment, you grant us the right to publish and edit it as needed, whilst retaining your ownership of the content. Your email address will never be published or shared, though it is required for moderation purposes.