[R] Data Manipulation

Rolf Turner r.turner at auckland.ac.nz
Thu Jan 21 02:41:35 CET 2010


A name such as ``Aerospace/Defense etc.'' is certainly not a legal
file name under unix-alike systems, and I suspect it would not
be even under Windoze.  Even if it is, you shouldn't use it!

Change the name to ``Aerospace-Defense Products & Services''
or something like that, for goodness sake.

	cheers,

		Rolf Turner


On 21/01/2010, at 2:19 PM, Peter Rote wrote:

>
> Thank you Dieter,
>
> but i  still have a problem to write to file. The problem is the  
> slash in
> file names (Aerospace/Defense Products & Services ). If i want  it  
> to C:/ab/
> so "C:/ab/AdvertisingAgencies.txt" is ok but
> "C:/ab/Aerospace/Defense-MajorDiversified.txt" is not
>
>> head(AlexETF)
>                         AlexETF.Industry         AlexETF.Ticker
> 1    Scientific & Technical Instruments                     A
> 2                              Aluminum                           AA
> 3                     Business Services                       AAC
> 4                       Credit Services                       AACC
> 5                     Regional Airlines                          AAI
> 6 Aerospace/Defense Products & Services             AAII
>
>> by(AlexETF,AlexETF$Industry,function(a) {filename = paste(gsub("
>> ","",a$Industry[1]),".txt",sep="")
> +      print(filename)
> +
> +    }
> + )
> [1] "Accident&HealthInsurance.txt"
> [1] "AdvertisingAgencies.txt"
> [1] "Aerospace/Defense-MajorDiversified.txt"
> [1] "Aerospace/DefenseProducts&Services.txt"
> [1] "AgriculturalChemicals.txt"
> [1] "AirDelivery&FreightServices.txt"
>
>
>
>> by(AlexETF,AlexETF$Industry,function(a) {filename = paste("C:/ 
>> ab/",gsub("
>> ","",a$Industry[1]),".txt",sep="")
> +      write.table(a,file=filename,col.names = FALSE)
> +    }
> + )
> Error in file(file, ifelse(append, "a", "w")) :
>   cannot open the connection
> In addition: Warning message:
> In file(file, ifelse(append, "a", "w")) :
>   cannot open file 'C:/ab/Aerospace/Defense-MajorDiversified.txt':  
> No such
> file or directory
>
>
>
> Thanks in advance,
>
> Peter
>
> -- 
> View this message in context: http://n4.nabble.com/Data- 
> Manipulation-tp1018249p1032029.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.


######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}



More information about the R-help mailing list