Quantcast
Channel: Question and Answer » gdal
Viewing all articles
Browse latest Browse all 397

Assing columnnames dynamically

$
0
0

I have an interesting problem:

I need to batchprocess a few files. I do that in a for-loop, where some operations are performed. Later on I want to write the outcome into an existing shapefile which I do like so:

myShapeFile@data <- data.frame(myShapeFile@data,  dynamicColumnName = VALUE)

The dynamicColumnName gets created dynamically – depending what statistic is performed and so on. Meaning: The name is stored in the variable.
So dynamicColumnName could be “2245″, in the next iteration of the loop or “0000″ or “3334″ and so on.

However, the function above does not accept the “characters/integers” stored in the variable. Each column gets named dynamicColumnName.

Any ideas how to not let this happen?


Viewing all articles
Browse latest Browse all 397

Trending Articles