Unconfigured Ad

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Marcos Lancia
    Member
    • Apr 2015
    • 31

    #16
    Ok, my table is ready. Now, my problem is that I have non-numerical data in my columns. How can I avoid that? For example,
    plot(data$log2.FC.transcriptome., data$log2.FC.translatome.)

    In min(x) : no non-missing arguments to min; returning Inf

    Comment

    • blancha
      Senior Member
      • May 2013
      • 367

      #17
      As always, there are many ways, and many subtleties.
      If you've been using read.csv, I would recommend that you add the argument stringsAsFactors=FALSE.
      You don't need to bother with fread, which won't treat strings as factors.

      I'll just post two ways to do the filtering, supposing that you know the strings that you want to filter out.
      I'll have to get back to work on my own script then.
      There is an older, more conventional method, but dplyr has many advantages.

      Code:
      library(dplyr)
      data.filtered <- data %>% filter(log2.FC.transcriptome. != "Inf" & log2.FC.transcriptome. != "-Inf" & log2.FC.translatome. != "Inf" & log2.FC.translatome. != "-Inf")
      Older method
      Code:
      data.filtered <- data[data$log2.FC.transcriptome. != "Inf" & data$log2.FC.transcriptome. != "-Inf" & data$log2.FC.translatome. != "Inf" & data$log2.FC.translatome. != "-Inf", ]
      Sorry, I really have to go and finish my own script now.

      Comment

      • Marcos Lancia
        Member
        • Apr 2015
        • 31

        #18
        Ok, thanks so much for your time. You helped me so much. If you can read this, there's a problem with the %>%.
        Error: could not find function "%>%"

        The 2nd option you gave me deleted all data. The table is empty after that command.

        Comment

        • blancha
          Senior Member
          • May 2013
          • 367

          #19
          The "%>%" forward-pipe operator comes with dplyr.
          Either you haven't loaded the dplyr package, or you made a mistake writing the operator.
          It's just the greater sign in between two percentage sign, so the second mistake is less likely.
          Just make sure you've installed dplyr and loaded the package before using "%>%".

          Code:
          install.packages("dplyr")
          library(dplyr)

          For the problems you're experiencing with the more conventional filtering step, I'm not sure what the problem could be.
          I don't see any typos in my command, but there could always be a mistake on my part.
          The best troubleshooting step is always to simplify the command.
          Try just one filtering step at the time.

          Code:
          data.filtered <- data[data$log2.FC.transcriptome. != "Inf", ]
          I'm going to stop procrastinating now by spending time on seqanswers, and actually finish my own R script.

          Comment

          Latest Articles

          Collapse

          ad_right_rmr

          Collapse

          News

          Collapse

          Topics Statistics Last Post
          Started by SEQadmin2, 06-05-2026, 10:09 AM
          0 responses
          13 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 06-04-2026, 08:59 AM
          0 responses
          24 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 06-02-2026, 12:03 PM
          0 responses
          28 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 06-02-2026, 11:40 AM
          0 responses
          22 views
          0 reactions
          Last Post SEQadmin2  
          Working...