[R] write.csv fails with $ operator invalid for atomic

John Kane jrkrideau at yahoo.ca
Tue Dec 1 23:10:42 CET 2009


Where does the table come from?

write.csv(t, file = "t.csv")

looks like it would work



--- On Tue, 12/1/09, ggraves <ggwraves at sfwmd.gov> wrote:

> From: ggraves <ggraves at sfwmd.gov>
> Subject: [R]  write.csv fails with $ operator invalid for atomic
> To: r-help at r-project.org
> Received: Tuesday, December 1, 2009, 1:36 PM
> 
> I want to export a csv file so I can do other things with
> it.
> 
> I issue this command to break down years as to whether it
> was windy or not:
> 
> t<-tapply(TURB,list(year,windy),mean,na.rm=T)
> 
> which results in:
> 
> > t
>             no   
>    yes
> 1990 21.516514  39.86400
> 1991 13.580435  28.87500
> 1992 12.171429  22.93913
> 1993 21.550893  26.41200
> 1994 12.003913  40.76928
> 1995 14.707917  35.39057
> 1996 22.041765  44.54927
> 1997 17.577625  31.60761
> 1998 26.283978  34.36190
> 1999 14.597922  43.85804
> 2000 30.805139  63.06042
> 2001 23.204545  36.64634
> 2002 21.062791  32.86696
> 2003 14.487111  33.68727
> 2004 36.294595  73.38125
> 2005 49.089583 114.28333
> 2006 44.941667  89.37917
> 2007 57.456667  70.00435
> 2008 52.251163  89.83864
> 2009 24.212821  37.49375
> 
> when I issue this command
> 
> write.csv(t$table, file = "t.csv")
> 
> I get the error
> 
> ERROR $ operator is invalid for atomic vectors
> 
> ??
> 
> 
> -- 
> View this message in context: http://n4.nabble.com/write-csv-fails-with-operator-invalid-for-atomic-tp932414p932414.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help at 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.
> 


      __________________________________________________________________
Yahoo! Canada Toolbar: Search from anywhere on the web, and bookmark your favourite sites. Download it now
http://ca.toolbar.yahoo.com.




More information about the R-help mailing list