HI Team, Need help with the below syntax. merge.salaries[, name:=paste("nameFirst","nameLast")]. Here merge.salaries is the data set I have merged. There are 2 columns nameFirst and nameLast I need to merge these two into one and name as name however I can getting an error: Error in `[.data.frame`(merge.salaries, , `:=`(name, paste("nameFirst", : could not find function ":=" Please advice. Thanks, Shivi Mb: 9891002021 -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20160204/99039a80/attachment.pl>
Hi Shivi, I usually do merge.salaries$name <- paste(merge.salaries$nameFirst, merge.salaries$nameLast) also if merge.salaries[, name:=paste("nameFirst","nameLast")] would work, you would end up with a column full of "nameFirst nameLast". Best, Ulrik On Thu, 4 Feb 2016 at 17:32 SHIVI BHATIA <shivi.bhatia at safexpress.com> wrote:> HI Team, > > > > Need help with the below syntax. > > > > merge.salaries[, name:=paste("nameFirst","nameLast")]. Here merge.salaries > is the data set I have merged. > > > > There are 2 columns nameFirst and nameLast I need to merge these two into > one and name as name however I can getting an error: > > > > Error in `[.data.frame`(merge.salaries, , `:=`(name, paste("nameFirst", : > > could not find function ":=" > > > > Please advice. > > > > Thanks, Shivi > > Mb: 9891002021 > > > > This e-mail is confidential. It may also be legally privileged. If you are > not the addressee you may not copy, forward, disclose or use any part of > it. If you have received this message in error, please delete it and all > copies from your system and notify the sender immediately by return e-mail. > Internet communications cannot be guaranteed to be timely, secure, error or > virus-free. The sender does not accept liability for any errors or > omissions. > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.[[alternative HTML version deleted]]
The problem in the original post is, as clearly stated , the ":=", which is some other language, not R. From which I infer that the OP needs to spend some additional time with an R tutorial or two to learn R. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Thu, Feb 4, 2016 at 9:12 AM, Ulrik Stervbo <ulrik.stervbo at gmail.com> wrote:> Hi Shivi, > > I usually do > > merge.salaries$name <- paste(merge.salaries$nameFirst, > merge.salaries$nameLast) > > also if merge.salaries[, name:=paste("nameFirst","nameLast")] would work, > you would end up with a column full of "nameFirst nameLast". > > Best, > Ulrik > > On Thu, 4 Feb 2016 at 17:32 SHIVI BHATIA <shivi.bhatia at safexpress.com> > wrote: > >> HI Team, >> >> >> >> Need help with the below syntax. >> >> >> >> merge.salaries[, name:=paste("nameFirst","nameLast")]. Here merge.salaries >> is the data set I have merged. >> >> >> >> There are 2 columns nameFirst and nameLast I need to merge these two into >> one and name as name however I can getting an error: >> >> >> >> Error in `[.data.frame`(merge.salaries, , `:=`(name, paste("nameFirst", : >> >> could not find function ":=" >> >> >> >> Please advice. >> >> >> >> Thanks, Shivi >> >> Mb: 9891002021 >> >> >> >> This e-mail is confidential. It may also be legally privileged. If you are >> not the addressee you may not copy, forward, disclose or use any part of >> it. If you have received this message in error, please delete it and all >> copies from your system and notify the sender immediately by return e-mail. >> Internet communications cannot be guaranteed to be timely, secure, error or >> virus-free. The sender does not accept liability for any errors or >> omissions. >> ______________________________________________ >> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
On 04/02/2016 3:33 AM, SHIVI BHATIA wrote:> HI Team, > > > > Need help with the below syntax. > > > > merge.salaries[, name:=paste("nameFirst","nameLast")]. Here merge.salaries > is the data set I have merged. > > > > There are 2 columns nameFirst and nameLast I need to merge these two into > one and name as name however I can getting an error: > > > > Error in `[.data.frame`(merge.salaries, , `:=`(name, paste("nameFirst", : > > could not find function ":="It looks as though you're using syntax defined by the data.table package, but you don't have it attached. Duncan Murdoch> > > > Please advice. > > > > Thanks, Shivi > > Mb: 9891002021 > > > > > > This e-mail is confidential. It may also be legally privileged. If you are not the addressee you may not copy, forward, disclose or use any part of it. If you have received this message in error, please delete it and all copies from your system and notify the sender immediately by return e-mail. Internet communications cannot be guaranteed to be timely, secure, error or virus-free. The sender does not accept liability for any errors or omissions. > > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.