I have been trying to visualise my data (saved as a data.table) as a boxplot however I can't seem to make it work and keep getting the error:
Error in x[floor(d)] + x[ceiling(d)] : non-numeric argument to binary operator
Which I assume is due to the fact that I'm using a data.table rather than a data.frame?
The code which I'm using:
metadata = read.table("Metadata.txt", stringsAsFactors = FALSE,
header = TRUE, sep = "\t")
conds = as.factor(metadata$Treatment)
cond_colours = brewer.pal(length(unique(conds)), "Set1")[as.factor(conds)]
names(cond_colours) = conds
boxplot1 <- boxplot(vis_data, col=cond_colours, las=2, cex.axis=.6)
Does anybody know of any work around that can help me visualise my data? Thanks
FJCC
May 23, 2021, 10:37pm
2
boxplot1 <- boxplot(vis_data, col=cond_colours, las=2, cex.axis=.6)
I do not see vis_data defined in the code you posted. Should that be metadata or did you leave out some code?
Sorry I 'vis_data' is a .csv file that I have imported
FJCC
May 23, 2021, 11:44pm
4
Can you post a copy/paste friendly version of all or part of vis_data? Either
dput(vis_data)
or, if that is too big, something like (adjust the 20 to a value that allows a minimal version of the plot you want.)
dput(head(vis_data, 20))
Sorry for not replying sooner, I tried the code but as it's such a large file (with so many variables) which you can view here - https://docs.google.com/spreadsheets/d/1IuZTigh49ZY12R2bxX95zJlMQHzoo8Dm6n5nG0jNV_Q/edit?usp=sharing
instead as I couldn't work out which bit you would want:
I have been reading the file in:
vis_data <- fread("./Peak_list.csv")
I wanted to import it as a .RDS file but haven't managed to get that to work either.
FJCC
June 8, 2021, 1:42pm
6
I clicked on the link to your data and I was denied access. Can you change the access settings?
Sorry, it should work now:
Thanks so much!
FJCC
June 8, 2021, 2:40pm
8
I do not understand which columns should be used to construct a box plot. Usually, it would be two columns: one with category labels and one with numeric values. Your data set has 3675 columns. The first six columns seem to be labels and the rest are numbers. The column names after the first six have an X prefix and then a number that seems to increment by about 0.1 or 0.2. Here are the first few and last few column names.
DF <- read.csv("Peak_list - Peak_list.csv")
> colnames(DF)[1:10]
[1] "X" "Filename" "Sample" "Treatment"
[5] "Bio" "Groups" "X279.806174604279" "X279.901903039171"
[9] "X280.048280936097" "X280.209829312778"
> colnames(DF[3664:3675])
[1] "X1177.58737661591" "X1177.69073192362" "X1177.80420341307" "X1178.00423460698"
[5] "X1178.45171805826" "X1178.68040503474" "X1178.78451995071" "X1179.00080510982"
[9] "X1179.42137392502" "X1179.6615975278" "X1179.78546293826" "X1180.03780565099"
Can you explain which columns need to be plotted?
system
Closed
June 29, 2021, 2:40pm
9
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed. If you have a query related to it or one of the replies, start a new topic and refer back with a link.