Can I facet data with NAs?

eFF

I would like to plot 4 years (2010-2013) out of 6 years (2008-2013) keeping the space assigned to 2008 and 2009 (for practical purposes). However, since I have NAs in those years, facet_grid complains:

"Error in layout_base(data, cols, drop = drop) : At least one layer must contain all variables used for facetting"

This is my dataset: https://www.dropbox.com/s/ehyccl8kubazs8x/test.csv?dl=0

This is my code:

cbbPalette <- c("#000000", "#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7")

ggplot(test) + 
  geom_jitter(aes(mean,NEE_f, colour=factor(month.x)),alpha=1,size=2) +  scale_colour_manual(values=cbbPalette)+
  labs(x = "WT to surface (cm)", y = "Reco (μmol/m2/s)")+
  facet_grid(~year)+
  theme_bw(base_size = 12, base_family = "Helvetica")+
  theme(legend.position="none",
        panel.grid.major = element_blank(),
        panel.grid.minor = element_blank(),
        strip.background = element_blank(),
        panel.border = element_rect(colour = "black"),
        panel.border = element_rect(colour = "black", fill=NA, size=1))

Quick and dirty solutions?

Cheers

Señor O

You can use facet.grid with NA values:

> df = data.frame(Date = as.Date(seq(300, 2000, 300), origin = "2000-01-01"), 
    x = rnorm(6), y = rnorm(6))
> df$Date[3] <- NA
> ggplot(df) + geom_jitter(aes(x, y)) + facet_grid(~Date)

enter image description here

You're problem is that you have no column named year, you only have year.x and year.y

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Can I replace NAs when joining two data frames with dplyr?

From Dev

How can I get `facet_wrap` plot for the data.frame named with unexpected long pattern?

From Dev

Can i make repositories in a NAS in GitHub for Windows?

From Dev

Can I still access a sitecore contact facet once session is flushed?

From Dev

How can I implement collections of objects in a Sitecore facet?

From Dev

How can I use facet_wrap using pie charts?

From Dev

How can I write a function to shift regression line for each Facet?

From Dev

How can I determine whether a component is inside a certain facet?

From Dev

How can I implement collections of objects in a Sitecore facet?

From Dev

Where can I get sources or detailed documentation of /usr/sbin/nas

From Dev

How can I find the IP of a NAS connected via SMB?

From Dev

How can I verify the health of hard disks using a Synology NAS?

From Dev

Can I emulate a NAS OS on Windows 7 with an extra network adpter?

From Dev

How can I change my NAS SSID and wireless password?

From Dev

How can I find the IP of a NAS connected via SMB?

From Dev

Where can I get sources or detailed documentation of /usr/sbin/nas

From Dev

Do fanless NAS devices exist? If not, can I build one myself?

From Dev

How can I diagnose a NAS SMB login failure?

From Dev

How can I preserve file modification times when copying to a NAS?

From Dev

How can I mount encrypted folder via SSH in Synology NAS?

From Dev

Is there a way I can switch on my computer or NAS with a phone call?

From Dev

Facet by year, with overlapping data

From Dev

Can I run a robocopy batch file from NAS1 to NAS2 without my local PC being on?

From Dev

I want to ssh to my NAS and connect to a docker instance running there, how can I do this?

From Dev

How can I repeat the x label for each panel in facet_wrap in ggplot?

From Dev

How can I build a long selectInput list and then use it to change the labels in facet_wrap

From Dev

How can I show different degree polynomial fits in ggplot2 with facet_grid?

From Dev

r - How can I get a lengthy label to fit using facet_grid in ggplot2?

From Dev

How can I fit X-axes labels in ggplot using facet_grid?

Related Related

  1. 1

    Can I replace NAs when joining two data frames with dplyr?

  2. 2

    How can I get `facet_wrap` plot for the data.frame named with unexpected long pattern?

  3. 3

    Can i make repositories in a NAS in GitHub for Windows?

  4. 4

    Can I still access a sitecore contact facet once session is flushed?

  5. 5

    How can I implement collections of objects in a Sitecore facet?

  6. 6

    How can I use facet_wrap using pie charts?

  7. 7

    How can I write a function to shift regression line for each Facet?

  8. 8

    How can I determine whether a component is inside a certain facet?

  9. 9

    How can I implement collections of objects in a Sitecore facet?

  10. 10

    Where can I get sources or detailed documentation of /usr/sbin/nas

  11. 11

    How can I find the IP of a NAS connected via SMB?

  12. 12

    How can I verify the health of hard disks using a Synology NAS?

  13. 13

    Can I emulate a NAS OS on Windows 7 with an extra network adpter?

  14. 14

    How can I change my NAS SSID and wireless password?

  15. 15

    How can I find the IP of a NAS connected via SMB?

  16. 16

    Where can I get sources or detailed documentation of /usr/sbin/nas

  17. 17

    Do fanless NAS devices exist? If not, can I build one myself?

  18. 18

    How can I diagnose a NAS SMB login failure?

  19. 19

    How can I preserve file modification times when copying to a NAS?

  20. 20

    How can I mount encrypted folder via SSH in Synology NAS?

  21. 21

    Is there a way I can switch on my computer or NAS with a phone call?

  22. 22

    Facet by year, with overlapping data

  23. 23

    Can I run a robocopy batch file from NAS1 to NAS2 without my local PC being on?

  24. 24

    I want to ssh to my NAS and connect to a docker instance running there, how can I do this?

  25. 25

    How can I repeat the x label for each panel in facet_wrap in ggplot?

  26. 26

    How can I build a long selectInput list and then use it to change the labels in facet_wrap

  27. 27

    How can I show different degree polynomial fits in ggplot2 with facet_grid?

  28. 28

    r - How can I get a lengthy label to fit using facet_grid in ggplot2?

  29. 29

    How can I fit X-axes labels in ggplot using facet_grid?

HotTag

Archive