code: private void append2slowstr() {
      // In case of all NAs and then a string, convert NAs to string NAs
      if (_xs != null) {
        _xs = null; _ms = null;
        alloc_str_indices(_sparseLen);
        Arrays.fill(_is,-1);
      }
  
      if(_is != null && _is.length > 0){
        // Check for sparseness
        if(_id == null){
          int nzs = 0; // assume one non-null for the element currently being stored
          for( int i:_is) if( i != -1 ) ++nzs;
          if( (nzs+1)*_sparseRatio < _len)
            set_sparse(nzs, Compress.NA);
        } else {
          if((_sparseRatio*(_sparseLen) >> 2) > _len)  cancel_sparse();
          else _id = MemoryManager.arrayCopyOf(_id,_sparseLen<<1);
        }
  
        _is = MemoryManager.arrayCopyOf(_is, _sparseLen<<1);
        /* initialize the memory extension with -1s */
        for (int i = _sparseLen; i < _is.length; i++) _is[i] = -1;
      } else {
        _is = MemoryManager.malloc4 (4);
          /* initialize everything with -1s */
        for (int i = 0; i < _is.length; i++) _is[i] = -1;
        if (sparseZero()||sparseNA()) alloc_indices(4);
      }
      assert _sparseLen == 0 || _is.length > _sparseLen:"_ls.length = " + _is.length + ", _len = " + _sparseLen;
  
    }
docs: Slow-path append string