Scatterplot - unexpected symbol error and multiple samples


I just joined the R-Community. I am biologist and I decided to learn R to design/present mostly nice graphs and plots. I downloaded RStudio and I would like to design a graph based on data from an experiment. I measured the activity of several samples by a colorimetric test during 10 minutes.

I would like to generate a scatter plot with x as time and y as the different colorimetric values.

Currently I have two issues:

1) I have an unexpected symbol when I try to plot a first sample.

Here are the names of my different samples

> colnames(Tuesday_Flask)
 [1] "Time"                        "BMD1 Blue pGAP Sec3...2"     "BMD1 Blue pGAP PaDa C2...3" 
 [4] "BMD1 Blue pGAP PaDa C6...4"  "BMD1 Blue pPIC PaDa C4...5"  "BMD1 Blue pPIC PaDa C8...6" 
 [7] "BMD1 Pink pGAP Sec3...7"     "BMD1 Pink pGAP PaDa C2...8"  "BMD1 Pink pGAP PaDa C6...9" 
[10] "BMD1 Pink pPIC PaDa C4...10" "BMD1 Pink pPIC PaDa C8...11" "BMD1 Blue pGAP Sec3...12"   
[13] "BMD1 Blue pGAP PaDa C2...13" "BMD1 Blue pGAP PaDa C6...14" "BMD1 Blue pPIC PaDa C4...15"
[16] "BMD1 Blue pPIC PaDa C8...16" "BMD1 Pink pGAP Sec3...17"    "BMD1 Pink pGAP PaDa C2...18"
[19] "BMD1 Pink pGAP PaDa C6...19" "BMD1 Pink pPIC PaDa C4...20" "BMD1 Pink pPIC PaDa C8...21"
[22] "BMMH Blue pGAP Sec3...22"    "BMMH Blue pGAP PaDa C2...23" "BMMH Blue pGAP PaDa C6...24"
[25] "BMMH Blue pPIC PaDa C4...25" "BMMH Blue pPIC PaDa C8...26" "BMMH Pink pGAP Sec3...27"   
[28] "BMMH Pink pGAP PaDa C2...28" "BMMH Pink pGAP PaDa C6...29" "BMMH Pink pPIC PaDa C4...30"
[31] "BMMH Pink pPIC PaDa C8...31" "BMMH Blue pGAP Sec3...32"    "BMMH Blue pGAP PaDa C2...33"
[34] "BMMH Blue pGAP PaDa C6...34" "BMMH Blue pPIC PaDa C4...35" "BMMH Blue pPIC PaDa C8...36"
[37] "BMMH Pink pGAP Sec3...37"    "BMMH Pink pGAP PaDa C2...38" "BMMH Pink pGAP PaDa C6...39"
[40] "BMMH Pink pPIC PaDa C4...40" "BMMH Pink pPIC PaDa C8...41"

When I try to plot a first samples depending on the Time, I have an unexpected symbol error.

> ggplot(Tuesday_Flask,aes(x=Time,y=BMD1 Blue pGAP Sec3))+geom_point()
Error: unexpected symbol in "ggplot(Tuesday_Flask,aes(x=Time,y=BMD1 Blue"

I cannot understand the problem in my command line, is it because the name of the samples is composed of several words separated by space?

  1. The second issue is that I would like to generate a single plot but with all the different sample measures (the time is the same for all my samples). I tried to find an online tutorial but I could not find any tutorial explaining how to plot several samples. Do I need to input each column name or is there a trick to ask RStudio to plot columns 2 to 41 in correlation with column 1 (Time).

Thank you in advance.

Do not hesitate to ask if you need more additional information.

Thank you

Yes, this is a non-syntactic variable name, if you want to use it you have to enclose it among backticks. `BMD1 Blue pGAP Sec3`

We like to keep things tidy around here, if you have different questions, please ask them on separate topics providing a proper REPRoducible EXample (reprex) illustrating your issue.

Thanks andresrcs.

It solved my first issue, I will create a new post with data for the second one.

Thanks again,

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.