value | R Documentation |
Get or assign a value to a data.frame
value_(df, i, j) 'modify_<-'(df,i,j,value)
df |
data.frame |
i |
row |
j |
column |
value |
value to be assigned |
The functions value_
and 'modify_<-'
return a data frame.
Properties:
Only rows determined by
i appear. If
i is missing, no row is filtered.
Only columns determined by
j appear. If
j is missing, no column is filtered.
Besides,
For function value_
:
If argument i
is non-missing and argument j
is missing, the function returns an object of the same type as df
.
If both arguments i
and j
are missing, the function returns an object of the same type as df
.
For function 'modify_<-'
:
The function returns an object of the same type as df
.
tmp <- value_(CO2,1,2) attributes(tmp) # data frame tmp <- value_(CO2,1:2,2) attributes(tmp) # data frame tmp <- value_(CO2,1:2,2:4) attributes(tmp) # data frame tmp <- value_(CO2,,2) attributes(tmp) # data frame tmp <- value_(CO2,2) attributes(tmp) # same as CO2 tmp <- value_(CO2) attributes(tmp) # same as CO2 df3 <- data.frame(id = 1:4, age = c(40,50,60,50), dose.a1 = c(1,2,1,2), dose.a2 = c(2,1,2,1), dose.a14 = c(3,3,3,3)) 'modify_<-'(df3,1,2,6) 'modify_<-'(df3,1:3,2:4,data.frame(c(20,10,90),c(9,3,4),c(0,0,0)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.