0

I'm new to R, and trying to use it to graph and analyze flow cytometry data sets. The end goal is to upload group of csv/excel files, concatenate them and graph different combinations of variables, but I'm struggling with getting the first data set to work.

library(tidyverse)
library(dplyr)
library(ggplot2)
library(readxl)
#load xls to df lscells
lscells <- read_xls('source.xls')
lscells <- data.frame(lscells)

#column in position 11 has been renamed to be more manageable
lscells <- lscells %>%
  rename_at(11, ~ 'Gr_Median_A')

#graph dose response plot with concentration (col4) the x axis, and 488 signal as the Y (col11)
#Discrete curves should be generated and segregated by compound (col3)
ggplot(data=lscells, aes(x = "Concentration", y = "Gr_Median_A")) 
+ geom_point(aes(color=Compound))

The column name is being changed, but the generated plot does not recognize the data, putting a single point at (0,0). Currently Concentration is stored as num, and y is int. (Compound is currently int).

I can get the following to work in matplot by following the advice of other threads, but for some reason it won't work on ggplot

matplot(
  x = lscells$'Concentration',
  y = lscells$'Gr_Median_A',
  type = 'pl',
  main = 'endocytosis',
  log = 'x',
 pch = 16,

 )
Scott
  • 17
  • 5
  • What is the output you get? It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input that can be used to test and verify possible solutions. But `aes(x = "Concentration", y = "Gr_Median_A")` looks wrong. You normally do not pass strings to `aes()`. It should be `aes(x = Concentration, y = Gr_Median_A)` or `aes_string(x = "Concentration", y = "Gr_Median_A")` or `aes(x = .data[["Concentration"]], y = .data[["Gr_Median_A"]])` – MrFlick Feb 28 '23 at 18:22
  • Thank you! I needed to switch to recognizing the columns as strings using either of the methods you presented. – Scott Feb 28 '23 at 18:42

0 Answers0