




 
  
  MCI
  
  
  A1
  
  
  A2
  
  
  A13
  
  
  A14
  
  
  A23
  
  
  A24
  
  
  A33
  
  
  A34
  
  
  Grouped together
  
 
 
  
  56766
  
  
  N/A
  
  
  N/A
  
  
  N/A
  
  
  N/A
  
  
  N/A
  
  
  N/A
  
  
  N/A
  
  
  N/A
  
  
  N/A
  
 
 
  
  6459
  
  
  N/A
  
  
  N/A
  
  
  N/A
  
  
  N/A
  
  
  N/A
  
  
  N/A
  
  
  N/A
  
  
  N/A
  
  
  N/A
  
 
 
  
  31233
  
  
  N/A
  
  
  N/A
  
  
  N/A
  
  
  N/A
  
  
  N/A
  
  
  N/A
  
  
  71280.7
  
  
  N/A
  
  
  N/A
  
 
 
  
  16790
  
  
  N/A
  
  
  N/A
  
  
  N/A
  
  
  N/A
  
  
  N/A
  
  
  N/A
  
  
  N/A
  
  
  N/A
  
  
  N/A
  
 
 
  
  13392
  
  
  284699.6
  
  
  N/A
  
  
  N/A
  
  
  N/A
  
  
  N/A
  
  
  N/A
  
  
  N/A
  
  
  N/A
  
  
  N/A
  
 
 
  
  1575
  
  
  N/A
  
  
  1196152
  
  
  1236735
  
  
  1322735
  
  
  1100289
  
  
  887130.2
  
  
  N/A
  
  
  N/A
  
  
  N/A
  
 


Figure 1 - Takeda2_nas.csv

Trying to get data in suitable format for Genstat



#clear console

rm(list=ls())

 

install.packages("reshape")

library(reshape)

 

#Read in data

#Takeda <-
read.table("Takeda2_nas.csv", sep = ",", header = TRUE,
row.names = 1)

#Takedastack <-
cbind(Takeda[gl(nrow(Takeda), 1, 40*nrow(Takeda)), 1], stack(Takeda[, 1:41]))

 

 

zz <-
read.csv("Takeda2_nas.csv",strip.white = TRUE)

#zzz <-
cbind(zz[gl(nrow(zz), 1, 40*nrow(zz)), 1], stack(zz[, 2:41]))

#Use reshape function to
change data

zzz <-
reshape(zz,varying=list(c("A1","A2","A13","A14","A23","A24","A33","A34","A39","A40","B9","B10","B5","B6","B15","B16","B27","B28","B31","B32","C3","C4","C7","C8","C11","C12","C17","C18","C21","C22","V19","V20","V25","V26","V29","V30","V35","V36","V37","V38")),direction="long")

#not ideal result i wanted

#write a table to excel

write.table(zzz,
"Takedashift.csv", sep=",")



Script 1 - datashift.r               

The result with above commands


 
  
  MCI (NONSENSE)
  
  
  Time (Actually
  MCI)
  
  
  A1 (1
  = A1 and so on)
  
  
  Id (Intensity)
  
  
  (COUNT)
  
 
 
  
  1.1
  
  
  56766
  
  
  1
  
  
  N/A
  
  
  1
  
 
 
  
  2.1
  
  
  6459
  
  
  1
  
  
  N/A
  
  
  2
  
 
 
  
  3.1
  
  
  31233
  
  
  1
  
  
  N/A
  
  
  3
  
 


 

 

Want the data to be


 
  
  MCI
  
  
  ID(sample)
  
  
  Intensity
  
 
 
  
  56766
  
  
  A1
  
  
  N/A
  
 
 
  
  6459
  
  
  A1
  
  
  N/A
  
 
 
  
  31233
  
  
  A1
  
  
  N/A
  
 


 




      
	[[alternative HTML version deleted]]


