Home > Net >  Paste data from excel with read.delim and forcing column to numeric
Paste data from excel with read.delim and forcing column to numeric

Time:11-22

I found out the option of read.delim to paste data from xlsx faster. So I came across the next problem.

As you can see the p.value is with the comma, by default is converting the vector in character, I want it as numeric (or integer, whatever the difference is). I could change it in Excel but I stick with doing it in R, and I wanted to do it without sub "," by ".". So I was trying kind of:

# the column "Var" is character but the p.value is numeric

pvalue <- read.delim(header = T, "clipboard", colClasses = c("character", "integer"))

enter image description here

Thanks!!

CodePudding user response:

Try this:

pvalue <- read.delim(header = TRUE, "clipboard", dec = ",")
  •  Tags:  
  • r
  • Related