> On Apr 7, 2016, at 7:44 PM, Michael Artz wrote:
>
> I don't get it, I thought the double index was to indicate and individual
> element within a column(vector)?
Character values by themselves either quoted or not are not assumed to refer to
column names unless you use `with` or `within`.
I don't get it, I thought the double index was to indicate and individual
element within a column(vector)?
I will stop using data.frame, thanks a lot!
On Thu, Apr 7, 2016 at 9:29 PM, David Winsemius
wrote:
>
> > On Apr 7, 2016, at 6:46 PM, Michael Artz wrote:
> >
> > data.frame.$columnToAdd["Cu
> On Apr 7, 2016, at 6:46 PM, Michael Artz wrote:
>
> data.frame.$columnToAdd["CurrentColumnName" == "ConditionMet"] <- 1
>
> Can someone please explain to me why the above command gives all NAs to
> columnToAdd? I thought this was possible in R to do logical expression in
> the index of a dat
you probably mean something like this
data.frame.$columnToAdd <- (data.frame.$CurrentColumnName ==
data.frame.$ConditionMet)
what you did is compare two character strings. They are not the same.
Therefore a new column
is created with the default value NA.
> tmp <- data.frame(A=1:4, B=c(1,3,4,5)
data.frame.$columnToAdd["CurrentColumnName" == "ConditionMet"] <- 1
Can someone please explain to me why the above command gives all NAs to
columnToAdd? I thought this was possible in R to do logical expression in
the index of a data frame
[[alternative HTML version deleted]]
__
5 matches
Mail list logo