1. E

    multi label problem

    Hi everyone, I'm currently working on my master dissertation. It is about the adoption of new products (COCA COLA PRODUCS). These are 26 new products. I need to determine which makes a foodservice business adopt the new products. I also have variables, such as environment of the business...
  2. M

    How to vectorize the following loop code?

    I have the following code for(i in 1:400) { if (mydata$quad[i]==1){ mydata$z[i]=rnorm(n=sum(mydata$quad[i]==1),mean=1,1) } else if (mydata$quad[i]==2){ mydata$z[i]=rnorm(n=sum(mydata$quad[i]==2),mean=9,1) } else if...
  3. M

    what is wrong with my code.

    Hello, there is a variable named quad take values from 1 to 9 ( 400 points) I'm trying to simulate a z variable as follows: fo for example if I have 30 points of quad=1 , i simulate 30 Z values with mean =0 the if I have 15 points of quad=2,I simulate 15 Z value with mean = 2 .... and so on...
  4. M

    what is wrong with my code

    I'm generating a random numbers x,y between -10 and 10 then I create an if statement to classify each pair(x,y) in 4 quadrant in the following if statement but the column quad give me all 4 so why? x <- runif(n=400, min = -10, max = +10) y <- runif(n=400, min = -10, max = +10)...
  5. M

    how to (x,y) values from xy plane in R

    Hello, I would like to generate random points on the x-y plane, for example let's set -10 < X < 10, -10 < Y < 10, and n = 400 how can I do that?
  6. M

    how to repeat the same row for two genes names

    I have the following row TMEM186;PMM2 cg00011459 0.92614347 0.950500413 0.941842608 0.942410506 0.948078755 0.872005565 0.934310136 0.906705645 0.948436255 I have many of these so please make your code general I want firs to separate the gene names into two rows and repeat the same row...
  7. M

    how to extract the F value in anova from a permutation test

    Hi I did a permutation test using the following code perm=replicate(1000,anova(lm(sample(genenormal)~as.factor(snptest1)))) the I got the following this is just one column , I have more than that : V1 Df c(2,1092) Sum sq c(48.96,9782.66) Mean sq...
  8. M

    how to put labels on ggplot2 graph

    I have a data and I did PCA on that data I used the following code i.pca=prcomp(tmydf) scores <- as.data.frame(i.pca$x) qplot(x = PC1, y = PC2, data = scores, geom = "point",col=race) I need to put the rownames of tmydf as labels on the graph how can I do that ?
  9. M

    how to give column names for a data in R

    hello, I have a file with 1117 columns and I have the names of these columns but how to give the names to those columns it is not efficient to write colnames(data)=c("name1", "name2",.....) because they are 1117 names any help
  10. M

    removing rows SNPS according to proportion minor allele < 5%

    hello, I know this should be easy but my brain can't get it I have the following part of data as data is 900,000 rows * 1000 columns V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 1 rs987435 C G 0 2 1 2 2 1 1 2 rs345783 C G 0 0 0 0 0 0 0 3 rs955894 G T 2 1 2 2 2...
  11. M

    replace -inf with 0 in data

    hello, I have data set about gene expression I discovered that there was some -inf in the data I need to replace them with zero my data is 390989 rows * 1000 column here is a row from my data (part of it) A1BG 0 0 5.604860 4.487620 5.545700 -inf I need to get A1BG 0 0 5.604860...
  12. M

    efficient R code

    I have the following code in R to creat .ped file and .map file that is used in Plink "open-source whole genome association analysis toolset" I need more efficient R code since the data I have is 905460 rows and 1120 columns and it takes forever to run , " I didn't get results for 2 days...
  13. J

    exporting results from HWE test in R

    Hello everyone I ran this function with many data (12.000 markers and 309 individuals) The HWE function gives a test for each marker and many results in the R console. BUt I CAN'T export this results to excel! and I cant use it, does anyone know a trick how to export it? I tried creating a...
  14. W

    [R packages] I want to know using the fastSOM packages correctly and plot spillover

    I recently know the fastSOM package from google. So I download the package. But I’m beginner in R. And I really want to studying spillover measures because I’m interested in volatility spillover. But It’s quite hard for me coding the spillover index. I got the paper from...