I have a task where I must create a character string representing ventilation units on a vast set of city government building rooftops. After taking the attribute information from the representational shapefile, I have a dataframe consisting of related descriptors. For each ventilation unit, or rooftop fan, there is column information ID'ing which city borough, city property, city property code and city property building number to which its' assigned. A geometry column is also available.
I created a new dataframe based on a count function which tallied all rooftop fans within each city property building code. My problem is that I am absolutely unsure how to create a column which, based on the city property building code creates a string from 1 up to the number for each respective adjacent row. This way every rooftop ID is linked to it's corresponding rooftop.
#List the column names of dataframe
> names(RoofFanLocationString)
[1] "vars" "n"
> #List the length of both columns
> length(RoofFanLocationString$vars)
[1] 931
> length(RoofFanLocationString$n)
[1] 931
#Create vector of first 20 city building codes
> BuildingValue <- (RoofFanLocationString$vars[1:20])
#Print out vector
> print(BuildingValue)
[1] "100.1" "100.2" "100.3" "101.1" "101.2" "101.3" "101.4" "102.1" "102.10"
[10] "102.2" "102.3" "102.4" "102.5" "102.6" "102.7" "102.8" "102.9" "103.3"
[19] "103.4" "103.5"
# Create vector of first 20 ventilation unit amounts
VentilationCounts <- (RoofFanLocationString$n[1:20])
#Print first 20 values of rooftop units
> print(VentilationCounts)
[1] 12 13 6 7 7 7 8 12 13 6 5 6 12 18 6 6 6 10 8 8
This example of code is meant to show that I want to append every element from the first list(Building Value) to every number from 1 to the numbered element of the second list(Ventilation Counts) in a new list.
It's obvious to me that this new vector will be much longer than each because of the different calculated permutations. It's not at all obvious to me how to execute this in R.
This is my first time messaging on the R Studio community. I mistakenly thought I'd be able to upload a csv file along with code snippets but it appears that capability is not here. I hope I've been concise enough to help whomever can help me.
Thank you