0

I have the following data frame, df in R:

ID    Name    Class
3     John    3A
32    Fanny   7B
12    Greg    3A

and I want to segregate the data, by creating a new dataframe for all rows with Class value 3A which means the new dataframe would be:

ID    Name    Class
3     John    3A
12    Greg    3A

Since rows above have value 3A in the Class column.

I tried the following:

df_2 <- df[df["Class"]=="3A"]

But the df_2 dataframe does not seem to appear.

Maxxx
  • 3,688
  • 6
  • 28
  • 55

1 Answers1

0

You are confusing the python and R

Here is the correct code:

df_2 <- df[df$Class=="3A", ]
df_2