########### produce the output image
png("T:dataforfigshare.png")
layout(matrix(c(1,1,2,3), 2, 2, byrow = TRUE))
#
variables = list (as.factor (data_ordtot$genotype), data_ordtot$ind)
LI_mean <- tapply(data_ordtot$values, variables, mean, na.rm= TRUE)
LI_sem <- tapply(data_ordtot$values, variables, std.error)
samplesize <-as.matrix(summary (data$genotype))
bar <- barplot(LI_mean, beside=T, ylim = c(-0.7,1), main=("nocolorlearning"),
axisnames =F, legend.text=( paste(levels(data$genotype), "(n=",samplesize,")" ) ), args.legend = list(x = "bottomright", ncol=2) )
# store location of bars in bar, and
# plot the barplot. ylim is used to
# make room for the error bar later
arrows(bar, LI_mean + LI_sem, bar, LI_mean - LI_sem,
length = 0, # width of the arrowhead
angle = 90, # angle of the arrowhead
code = 3 # arrowhead in both ends
)
axis(1, at=seq(bar [2,1], bar [2,7],by= (length(levels(data_ordtot$genotype))+1)), tick =T,
labels=c("pretest","training","training","test","training","training","test"), las = 1)
abline(h=seq(0,1,.2),col=2, lty=3)
#
plot(data$X8_test2/10000~data$genotype, las=2, ylab="learning score", xlab="", cex.axis=0.6,main="score absolute during final test")
abline(h=0, col=2)
#
plot(data$scorerelative~data$genotype, las=2, ylab="learning score", xlab="", cex.axis=0.6, main="score final test - pretest")
abline(h=0, col=2)
dev.off()
### write data file
write.csv(data_ori, file="T:data.csv")
#############################################################################################################################
########### on Figshare
## you need to install Rtools first (the version which correspond to your R version)
## install devtools package then, rjson package
# you need to set figshare to receive R commands: https://github.com/ropensci/rfigshare
## Julien Colomb = 97229
## Björn Brembs = 96464
###start installing packages
# colomb account
options(FigshareKey = "jBkrLNsYbeov2oM09cXBBw")
options(FigsharePrivateKey = "LhQkDeJaVJzAhWRIKYeobA")
options(FigshareToken = "BYuYn4OjWjd8njBKCyeFXQOEAYY1MfLJ1Y0z80rVWj6AXYuYn4OjWjd8njXKCyeFXQ")
options(FigsharePrivateToken = "aC2q4lBod3Xl52CeKwp7Fg")
###end figshare info
#brembs lab account
options(FigshareKey = "ABqLKahr9d8EBuBCdBBxpg")
options(FigsharePrivateKey = "OCehduRnbLFvQBtD4KAZBA")
options(FigshareToken = "Jr4eYBQkgEuOvJ5PdAlXpQ851uziewWIa5M3EgqpySAQJr4eYXQkgEuOvJ5PdAlXpQ")
options(FigsharePrivateToken = "0WX9Lz0bWN5TA3fP0xnAXA")
###end figshare info
require(rfigshare)
fs_auth()
##need to create the article and get its id here: do it only once, then write the id and comment this part:
### fileset where all other will be included (not implemented yet)
if (is.na(id_fileset)){
id <- fs_new_article(title = article_title, description = article_description,
type = "fileset", tags = article_tags, categories=article_categories ,
files = "D:/Bilder/Toolbox/fulogo.jpg",
visibility= article_visibility, authors = article_authors,
links=article_links)
id_fileset <- id
}
### Figure for the experiment: result page
if (is.na(id_figure)){
id <- fs_new_article(title = paste("figure for",article_title), description = article_description,
type = article_type, tags = article_tags, categories=article_categories ,
files = "T:dataforfigshare.png", visibility= article_visibility, authors = article_authors,
links=article_links)
id_figure <- id
}else{
newfile= "T:dataforfigshare.png"
fs_upload(id_figure, file =newfile)
}
### data analyzed for the experiment: data dataset
if (is.na(id_data)){
id <- fs_new_article(title = paste("data for",article_title), description = "analyzed data. Were excluded from the analysis:
data with an entry in the remark field,
data with a pretest score >6000.",
type = "dataset", tags = article_tags, categories=article_categories ,
files = "T:data.csv", visibility= article_visibility, authors = article_authors,
links=article_links)
id_data <- id
}else{
newfile= "T:data.csv"
fs_upload(id_data, file =newfile)
}
### raw data produced during the experiment (no formatting): drawdata dataset
#1 make the article
if (is.na(id_rawdata)){
id <- fs_new_article(title = paste("raw data for",article_title), description = "raw data, columns are time(ms)-torque measure (V)- phase of the paradigm - laser on signal. note that discrepency between the raw data and the analysed data can be found for pretest phase: the zero is sometimes readjusted at the end of the prephase and the score recalculated.",
type = "fileset", tags = article_tags, categories=article_categories ,
#files = list(rawfilenames),
visibility= article_visibility, authors = article_authors,
links=article_links)
id_rawdata <- id
}
#2 upload the files (only the one not already uploaded)
if (length(rawfilenames)>alreadyuploaded){
first=alreadyuploaded+1
for (i in c(first:length(rawfilenames))){
fs_upload(id_rawdata,rawfilenames[i])
}
}
alreadyuploaded <- length(rawfilenames)
if (is.na(id_code)){
id <- fs_new_article(title = paste("code used for analysing",article_title), description = "code used, two codes are called from the first main file, the address of these code would have to be modified for the code to be run)",
type = "fileset", tags = article_tags, categories=article_categories ,
#files = list(rawfilenames),
visibility= "public", authors = article_authors,
links=article_links)
id_code <- id
}
#2 upload the files (only the one not already uploaded)
fs_upload(id_code,thisfile)
fs_upload(id_code,"D:/dokumente/data/Rfiles/fs/dataanalysis3g.r")
fs_upload(id_code,"D:/dokumente/data/Rfiles/fs/dataanalysisfigshare.r")
##write info that will be needed for updating the articles
ids <- c("id_fileset"= id_fileset, "id_figure"=id_figure, "id_data"=id_data,"id_rawdata"=id_rawdata, "id_code"=id_code,"alreadyuploaded"=alreadyuploaded)
write.table(ids, file="id_numbers.txt")
#
#
# tests
#
# fs_update
# article_title= "test3"
# article_description = "this is a temporary article"
# article_type = "figure" #, "dataset" #,"media", "poster", "paper", "fileset"
# article_tags = c("self-learning","genetics")
# article_categories="Neuroscience"
# article_files = "T:dataforfigshare.png"
# article_visibility= "draft" #"private" "public" #
# article_authors= list("97229")
# article_authors= list("97229","96612")
# article_links="http://lab.brembs.net"
#
#
# id <- fs_new_article(title = article_title, description = article_description,
# type = article_type, tags = article_tags, categories=article_categories ,
# files = article_files, visibility= article_visibility, #authors = article_authors,
# links=article_links)
#
# fs_add_authors(id,article_authors)
# fs_author_search("julien colomb")
#
# id <- fs_new_article(title="A Test of rfigshare",
# description="This is a test of the fs_new_aricle function and related methods"
# ,
# type="figure",
# authors=c("97306")
# ,tags=c("ecology", "openscience"),
# categories="Ecology",
# links="http://ropensci.org",
# files= article_files,
# # visibility="private"
# )
#
# id <- fs_new_article(title="A Test of rfigshare",
# description="This is a test of the fs_new_aricle function and related methods",
# type="figure",
# authors=c("97306", "Scott Chamberlain"),
# tags=c("ecology", "openscience"),
# categories="Ecology",
# links="http://ropensci.org",
# files="figure/rfigshare.png",
# visibility="private")
# fs_delete(id)