0

I am trying to do some analyses with R and experienced some problems when doing it with my Macbook. When reading the csv file in R it tells me that the numeric values are empty.

That's how it looks like when I try to run an analysis:

pall.values = numeric()
 df <- data.frame(Estimate=numeric(50), P.value=numeric(50))
 for (i in 2:51){  #change the column range based on your data sheet
     x <- cor.test(fdata[,c(i)],fdata$ARHQ_dad)
     df$Estimate[i-3]=x$estimate
     df$P.value[i-3]=x$p.value
 }

Then this error occurs:

Error in cor.test.default(fdata[, c(i)], fdata$ARHQ_dad) : 'x' must be a numeric vector

The csv itself recognizes the values as numbers since I used the Data to Column function and divided the columns by spaces and commas. However, in R it doesn't seem to work...

I hope somebody knows the answer to this (simple) problem.

samAlvin
  • 1,648
  • 1
  • 11
  • 35
  • What's in `fdata`? We have no idea what your data looks like so it's not easy to help. When asking for help, you should include a [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input data that we can use to run and test your code. – MrFlick Aug 03 '17 at 14:35
  • Fdata describes the dataset I am using which contains a matrix of 83 rows (subjects of a study) and 50 columns (brain data) that looks something like this: node_13 node_14 node_15 node_16 node_17 node_18 node_19 node_20 node_21 node_22 node_23 node_24 node_25 node_26 1 0.188296 0.195567 0.203880 0.212286 0.220239 0.227744 0.233379 0.237880 0.242103 0.244735 0.246257 0.246948 0.247150 0.247076 – Letitia D'Souza Aug 03 '17 at 16:32

0 Answers0