that did the trick. thanks a lot!
john
jim holtman wrote:
Actually change the TreeTag to characters first because you are trying
to store in a new factor value that is not there
yr1bp$TreeTag <- as.character(yr1bp$TreeTag)
yr1bp$TreeTag[1501]<-sub("1.00", "1", yr1bp$TreeTag[1501])
# change b
Actually change the TreeTag to characters first because you are trying to
store in a new factor value that is not there
yr1bp$TreeTag <- as.character(yr1bp$TreeTag)
yr1bp$TreeTag[1501]<-sub("1.00", "1", yr1bp$TreeTag[1501])
# change back to a factor if desired
yr1bp$TreeTag <- factor(yr1bp$TreeTa
try:
yr1bp$TreeTag[1501]<-sub("1.00", "1", as.character(yr1bp$TreeTag[1501]))
Since it appears that TreeTag is a factor. This can be verified with 'str'.
On Fri, Jun 6, 2008 at 11:22 PM, john.polo <[EMAIL PROTECTED]> wrote:
> Daniel Folkinshteyn wrote:
>
>> works for me:
>> > sub('1.00', '1',
Daniel Folkinshteyn wrote:
works for me:
> sub('1.00', '1', '1.00E-20')
[1] "1E-20"
when i input what you wrote, i get the same result. but that doesn't
change the value for TreeTag at row 1501, it's just floating around in
space. if i try it for yr1bp$TreeTag[1501], which is 1.00E-20 i get thi
works for me:
> sub('1.00', '1', '1.00E-20')
[1] "1E-20"
remember, according to ?sub, it's sub(pattern, repl, string)
try doing it step by step. first, see what yr1bp$TreeTag[1501] is.
then, if it's the right data item, see what the output of sub("1.00",
"1", yr1bp$TreeTag[1501]) is.
that'll l
dear R users,
the data frame (read in from a csv) looks like this:
TreeTag CensusStage DBH
1 CW-W740 2001 juvenile 5.8
2 CW-W739 2001 juvenile 4.3
3 CW-W738 2001 juvenile 4.7
4 CW-W737 2001 juvenile 5.4
5 CW-W736 2001 juvenile 7
6 matches
Mail list logo