该问题与此问题(How to set multiple columns in a data table to values from different columns in the same data table?)有些相关。
dt[1:3, c("X1","X2"), with = F] = dt1[1:3, c("X3","X5"), with = F]
这次,我想更改某个行和列。
Error in `[<-.data.table`(`*tmp*`, 1:3, c("X1", "X2"), with = F, value = list( :
unused argument (with = F)
但是这个给出了一个错误:
{{1}}
我会用数据做很多列。我希望列的名称最初应该是字符。
答案 0 :(得分:2)
通过使用cdef class PyRectangle:
cdef Rectangle *thisptr
def __cinit__(self, int x0, int y0, int x1, int y1):
self.thisptr = new Rectangle(x0, y0, x1, y1)
property lower_left:
def __get__(self):
c = PyCoord()
# for some reason I couldn't do two levels of pointer access at once...
# so we use a temporary
thisptr = self.thisptr
c.set_ptr(&thisptr.lower_left,self)
return c
# lower_right looks identical
运算符,您尝试将值分配给 data.table 中的所需位置。相反,您应该使用=
内的dt
运算符通过引用更新 data.table :=
。稍微调整@ thelatemail的评论(不需要第二个dt[...]
):
with = FALSE