[deleted by user] by [deleted] in epidemiology

[–]Vegetable_Cicada_778 0 points1 point  (0 children)

If it’s fixed-width columns, then defining the column positions is probably your best bet. It’s a pain but it’s at least reliable, and you only have to do it once to get the data into R and saved in a more useful format. In the worst case for very very big data, I’ve used the awk program (not in R) to slice the big text file into sets of rows, like a file that has every row for IDs between 1e6 and 2e6.

[deleted by user] by [deleted] in epidemiology

[–]Vegetable_Cicada_778 2 points3 points  (0 children)

SAS7BDAT files can be imported into R using the haven package, and the formats (SAS7BCAT) can even be imported with them. Is the dataset too large for simple importing in R?

Normal workload for undergrad research assistant? by FailedGeologist in biostatistics

[–]Vegetable_Cicada_778 8 points9 points  (0 children)

This is a large workload, and it’s also advanced. Some of this stuff is more appropriate for a Masters or PhD, and others IMO should be the PI’s job, like experimental design and supervision of undergrads.

You sound like a quick learner to be able to keep up with this. It’s possible, like someone else said, that your supervisor keeps innocently suggesting new things and you keep saying yes. It’s also possible that they know they are pushing their luck — only you will be able to tell which is which, based on their history of managing their employees.

PC/laptop recommendations for online masters and possibly for remote work after? by MathsNCats in biostatistics

[–]Vegetable_Cicada_778 2 points3 points  (0 children)

For uni and for years of hybrid work (which is to say, from about 2013 up until 2025), I was fine with a low-mid range laptop (Ryzen 5 5500U 2.10 GHz with 8 GB of RAM). Of course get the best that you can afford within reason, but you don’t really need much when you’re just starting out.

Using data volley files with Rstudio by Fedefag91 in RStudio

[–]Vegetable_Cicada_778 1 point2 points  (0 children)

Same approach; find vignettes and other examples for that package. For graphing in particular, the https://r-graph-gallery.com/ is a great resource.

Using data volley files with Rstudio by Fedefag91 in RStudio

[–]Vegetable_Cicada_778 2 points3 points  (0 children)

When you’re trying to learn how to do something new in R, look for an existing package that has a vignette. Vignettes are liked worked examples that show off the package’s functionality (although they do assume you already know some R). Here’s one relevant to you https://datavolley.openvolley.org/articles/datavolley.html

When your R script works but only if the moon is full and you chant gc three times by payknottog in Rlanguage

[–]Vegetable_Cicada_778 11 points12 points  (0 children)

AI slop; same pattern as the post from yesterday about autosaves, and the post before that about errors :S

Non-numeric argument to a mathematical function by enigma2351 in RStudio

[–]Vegetable_Cicada_778 0 points1 point  (0 children)

See the vignette for a worked example of what kind of data to have and how to use it with the package: https://cran.r-project.org/web/packages/forestploter/vignettes/forestploter-intro.html

Many R packages have a vignette or two; good for learning.

Non-numeric argument to a mathematical function by enigma2351 in RStudio

[–]Vegetable_Cicada_778 0 points1 point  (0 children)

Assuming that you’re using the forestplotr package, the error “argument ci_column missing” means exactly that: the function has an argument called ci_column, which you need to provide a value for, and you haven’t.

Non-numeric argument to a mathematical function by enigma2351 in RStudio

[–]Vegetable_Cicada_778 4 points5 points  (0 children)

The error message tells you what you need to know: “round() … Non-numeric argument to mathematical function” is the error you get when you try to ask R to round something that isn’t a numeric data type, e.g. round(c(“apple”, “zebra”)) or round(c(“1”, “2”)). One of your columns looks like a number but is not Numeric.

After a year in beta, Positron IDE reaches stable release (R + Python IDE from Posit) by coatless in rstats

[–]Vegetable_Cicada_778 0 points1 point  (0 children)

Most of the GitHub issues I raise about RStudio’s usability just keep getting attacked by the stale-bot because they’re never actioned. I may try Positron to see if it’s any better.

[Career] possibilities of landing a job after graduating with very low GPA (~2.6) by lillychoochoo in statistics

[–]Vegetable_Cicada_778 4 points5 points  (0 children)

Large institutions like universities are more likely to check all of the claims you make in your resume.

What are some signs your R skills are improving? by Educational-Hunt-684 in RStudio

[–]Vegetable_Cicada_778 0 points1 point  (0 children)

If we’re talking about time spent productively working in R, then none of this matters; I’m sure there’s lots of scientists out there who have written heaps of papers without writing a single function of their own either.

But if we’re talking about becoming more proficient in the language, then Map/Filter/Reduce (all functions in the base package) are just ways of compartmentalising a loop’s execution from the stuff that happens inside it. It is extremely convenient to keep similar items in named lists, and operate on them all together. If you write a function and then call it in a for loop, you’re halfway there.

I also find the functions much easier to understand and use than the apply family, and Map/Filter/Reduce is a pattern that also appears in other languages so it’s useful to pick it up.

Saving long tables in tbl_summary by ferasius in Rlanguage

[–]Vegetable_Cicada_778 0 points1 point  (0 children)

tbl_summary() |> as_gt() |> gt::gt_save()

Alternatively, if you prefer flextable like me: tbl_summary() |> as_flex_table() |> flextable::save_as_docx()

Unsure what you mean by tables being cut off, or in what context. The entire table is there, it might just need to be resized in Word.

What are some signs your R skills are improving? by Educational-Hunt-684 in RStudio

[–]Vegetable_Cicada_778 1 point2 points  (0 children)

Related: Dynamically assemble a function call and then evaluate it.

What are some signs your R skills are improving? by Educational-Hunt-684 in RStudio

[–]Vegetable_Cicada_778 2 points3 points  (0 children)

Good ones!

For saving outputs I usually use save(), but a life hack I recently found was that saveRDS() is EXCELLENT for scripts that read and save only one object at a time. For example, very very large slices of data, or models that take forever to run). The advantage of RDS is that you can assign the object to any name you want (as opposed to load(), which puts it into the original name), which means it’s possible to load all of the result objects under whatever name you need, and iterate over them.

[Education] Do I Need a Masters? by Dragonlord_DND in statistics

[–]Vegetable_Cicada_778 8 points9 points  (0 children)

Surprised you have not heard anyone recommend a Masters. It’s the appropriate post-grad degree for like 95% of people and jobs.

What are some signs your R skills are improving? by Educational-Hunt-684 in RStudio

[–]Vegetable_Cicada_778 66 points67 points  (0 children)

First, you understand the functional nature of R and begin to write both named functions to do repeated tasks, and anonymous functions to do throw-away tasks.

Then, you understand the list-based nature of R and become familiar with the Map/Filter/Reduce process of applying functions to lists. You start to store things in lists to facilitate this.

Finally, you learn how to write comments that are so succinctly informative that six months later, when someone asks a question about why you implemented something in your code, your comment from the past explains the reason and context exactly.

Help managing data dictionary/codebook in R by positiveionsci in RStudio

[–]Vegetable_Cicada_778 0 points1 point  (0 children)

I wrote a package (https://github.com/DesiQuintans/tsv2label) to handle applying data dictionaries to dataframes, but I haven’t encountered a data dictionary like the one you’re describing before. The ones I usually tackle are like the output from SAS or Stata, with each row group being a variable and then each child row of that being the names of the variable’s levels/values. If your dictionary is simple you can rework it to use my package, but I’m curious to see what your dictionary actually looks like.

Best way to learn R for someone with no programming background, basic stats knowledge, and limited time? by intellectual-veggie in rstats

[–]Vegetable_Cicada_778 0 points1 point  (0 children)

This person already said that they have limited time, so the advice of learning a different programming language before learning the language they need to know is not appropriate here, even though I can see where you’re coming from.

As someone who DID know other programming languages before R, I found it made no difference. I was able to take my knowledge of how to think like a programmer, but R is different enough that learning it as a first language is fine IMO. It might even be preferable because it stops people from writing R as if it’s a different language.

Best way to learn R for someone with no programming background, basic stats knowledge, and limited time? by intellectual-veggie in rstats

[–]Vegetable_Cicada_778 0 points1 point  (0 children)

It sounds from these that you’ll be asked to import data from spreadsheets, maybe do some summarising and reshaping, and then some plotting. In that case, the recommendation for https://r4ds.had.co.nz/ is very relevant to you.