value {m61r}R Documentation

get or assign a value to a data.frame

Description

Get or assign a value to a data.frame

Usage

value_(df, i, j)

'modify_<-'(df,i,j,value)

Arguments

df

data.frame

i

row

j

column

value

value to be assigned

Value

The functions value_ and 'modify_<-' return a data frame. Properties:

Besides,

Examples


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)))


[Package m61r version 0.0.3 Index]