125 questions from the last 30 days
Advice
0
votes
0
replies
18
views
How to force rms::redun to treat spline interaction terms as a single chunk?
I am performing a redundancy analysis using rms::redun() in R. My model includes an interaction between a binary treatment variable and a restricted cubic spline of a continuous variable: treatment * ...
0
votes
1
answer
64
views
R Code to recognize speaker turns in verbatim records with inconsistent formatting
I am trying to perform text analysis on large character strings that include multiple different speakers. I need to create a dataframe of 2 columns, speaker and turn, which have the person speaking ...
-3
votes
0
answers
42
views
R sf installation fails on Debian 11 Bullseye with undefined symbol: internal_proj_trans_array
I am trying to install the sf package in R on Debian 11 Bullseye, but I have been unable to get a working installation after several attempts.
System information
Debian Bullseye
R: 4.5.2
No sudo ...
0
votes
0
answers
40
views
Multiple time series plot [duplicate]
I'm trying to plot multiple time series in one figure. How can i do so? This is the code i used to plot the first one:
library(ggplot2)
library(ggfortify)
data1 <- read.csv("data1.csv")
...
1
vote
0
answers
68
views
zscore function not found [closed]
I'm working in R and have a dataframe mtcars with cars having a column wt (weight of the cars). I'm trying to calculate skewness of weights.
The following is the exercise as shown in the book. The 1st ...
2
votes
2
answers
90
views
Make a new column based on the count of rows, in an existing column, that meet a condition
My dataframe is called detections. One column is OBSERVER. That column contains the initials of 32 different people. Some of those observers are responsible for 1000+ observations (i.e. 1000+ lines ...
2
votes
1
answer
61
views
Assign colors of geom_lines with multiple legends by group in a nested facet_wrap
As Stefan suggested here, splitting the legend into multiple rows on a nested facet_wrap using legendry::guide_legend_group works well.
However, the colors are inconsistent (e.g., see the left graph ...
2
votes
1
answer
47
views
How to get geom_text to always show above geom_bar
I'm working with the Insurance data set. Created a summary of the Insurance data set, where the charges are sorted from highest to lowest, and labeled as "Highest_five_percent" and "...
4
votes
4
answers
123
views
Changing column values based on values of separate columns
I'm trying to figure out how to change values in a column (Age), based on the values of two separate columns (Species and Length).
I have a dataset of fish lengths, with all of them designated either &...
3
votes
1
answer
94
views
Interactive data entry [duplicate]
I have a program saved in a .R file. One of the challenges I have with it is that I have a statement that is supposed to read data from the keyboard which is not working. The statement is
num_itr <-...
1
vote
1
answer
92
views
Can R handle non-English data?
I'm launching a study that involves disseminating a survey in a bunch of different languages (English, Spanish, Arabic, etc.). In advance of launching the survey, I was looking at how the data will ...
0
votes
0
answers
84
views
Borders of vertically merged cells appear correctly only in preview, not in rendered PDF
I am generating a PDF from R Markdown using flextable.
When I vertically merge cells, the borders of the merged cells appear correctly in the preview, but they do not appear correctly in the rendered ...
0
votes
3
answers
189
views
How to use regex in R to shorten strings by one space
I have some old data files with a large number of writing errors. An example is attached below, where some of the numbers in the .dat file are 9 digits or characters long rather than the expected 8.
...
5
votes
1
answer
263
views
Split the legend into three rows with headings for a nested facet_wrap
The dataframe df0 below includes the following variables:
site: 3 remote partner laboratories (fixed number),
analyte: biomarkers measured at one or more of these sites (3 analytes in this example ...
Tooling
0
votes
7
replies
125
views
Visualizing a 3D table or spreadsheet in R
I want to visualize a 3D data structure in a 3D table or spreadsheet in R. Much like a 2D spreadsheet, for example in Excel, but with three-dimensional cells. Here is a rough sketch of what I want to ...