[Solved] Processing the data in a matrix in r [closed]

NOTE: Your question as it stands is not appropriate for this site. You should include a minimum reproducible example. Include code that you’ve tried and where it’s causing you trouble. At this point, you’re likely to continue getting down votes, and your question may potentially get closed. Be aware of that. Please visit the help … Read more

[Solved] Cannot allocate a vector in R

Simplest answer: Purchase more RAM. If you work in R with large datasets often, it’s worth it. If you don’t have enough memory to load your files, you may not have enough to manipulate them as you want either. Let’s assume that you could hold this data in RAM and manipulate it as you wish … Read more

[Solved] Line graph with ggplot2 in R Studio [closed]

Next time please include the head this can be done using head(Store_sales) ProductID category sales product 1 101 Bakery 9468 White bread 2 102 Personal Care 9390 Everday Female deodorant 3 103 Cereal 9372 Weetabix 4 104 Produce 9276 Apple 5 105 Meat 9268 Chicken Breasts 6 106 Bakery 9252 Pankcakes I reproduced relevant fields … Read more

[Solved] How to convert string rule to an expression which has a range in R [closed]

I’d do it in several steps: Split on logical operators into separate inequalities. Change double inequalities like -3>x1>=-1.45 into two inequalities. Change “=” to “==”, and put it all together. For example: a1 <- strsplit(a, “&”, fixed = TRUE)[[1]] a1a <- gsub(” “, “”, a1) # get rid of spaces a2 <- gsub(“([-0-9.]+[<>=]+)([[:alpha:]]+[[:alnum:]]*)([<>=]+.+)”, “\\1\\2 & … Read more

[Solved] Memory issues in-memory dataframe. Best approach to write output?

I have been using the following snippet: library(data.table) filepaths <- list.files(dir) resultFilename <- “/path/to/resultFile.txt” for (i in 1:length(filepaths)) { content <- fread(filepaths, header = FALSE, sep = “,”) ### some manipulation for the content results <- content[1] fwrite(results, resultFilename, col.names = FALSE, quote = FALSE, append = TRUE) } finalData <- fread(resultFilename, header = FALSE, … Read more