Question: based on data table I got a column name xyz
and in that column I want to drop student from “outstate” in “xyz” column, than save the column to “ppp”
PPP <- data[code here, ]
Question: based on data table I got a column name xyz
and in that column I want to drop student from “outstate” in “xyz” column, than save the column to “ppp”
PPP <- data[code here, ]
Since the question does not include enough accompanying data or code to make the question understandable, it's assumed that what is wanted is to add a new variable to an existing dataframe. If so, then just assign the new vector to the existing dataframe. The new vector should be the same length as the existing df.
x <- c(1:5)
y <- c(12:16)
z <- c(24:20)
df <- data.frame(x, y, z) # existing dataframe
o <- c(99:95) # other vector
df$new <- o # other vector assigned to existing df
print(df)
x y z new
1 1 12 24 99
2 2 13 23 98
3 3 14 22 97
4 4 15 21 96
5 5 16 20 95