Hi, how correctly write in R something like this?:
UPDATE Customers
SET ContactName = 'Alfred Schmidt', City= null
WHERE CustomerID = 1;
Hi, how correctly write in R something like this?:
UPDATE Customers
SET ContactName = 'Alfred Schmidt', City= null
WHERE CustomerID = 1;
Here is one way to do that.
Customers <- data.frame(CustomerID=1:2,ContactName=c("A","B"),
Address=c("M","N"),City=c("Y","Z"))
Customers
CustomerID ContactName Address City
1 A M Y
2 B N Z
Customers[Customers$CustomerID==1,c("ContactName","City")] <- c("Alfred Schmidt","null")
Customers
CustomerID ContactName Address City
1 Alfred Schmidt M null
2 B N Z
If this is part of a larger process, there might be a more efficient way to do it.
Thank you very much. But I want to see null as an empty field, not a text
I think an NA would be appropriate in R.
Customers[Customers$CustomerID==1,c("ContactName","City")] <- c("Alfred Schmidt",NA)
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.
If you have a query related to it or one of the replies, start a new topic and refer back with a link.