Readers, A csv file was created:
column1,column2,column3,column4 1,10,3,2 2,20,6,4 3,30,12,16 4,40,24,256 The csv was imported: testcsv<-read.csv('/path/to/test.csv') testsum<-testcsv[2,2]+testcsv[2,3]+testcsv[2,4] What is the correct syntax to abbreviate the following command using the function 'with', to avoid repetitive use of the declaration 'testcsv'? Tried the following, but received the error shown: with(testcsv,testsum<-[2,2]+[2,3]+[2,4]) Error: unexpected '[' in "with(testcsv,testsum<-[" and: with(testcsv,{testsum<-[2,2]+[2,3]+[2,4]}) Error: unexpected '[' in "with(testcsv,{testsum<-[" ______________________________________________ R-help@r-project.org mailing list 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.