# Beginner at R and getting a different output, need to understand why am getting such an output. Please help!

I was trying to find the price per square feet and used dplyr but I got an output with NA

combine1 <-
history %>%
left_join (y=building, by=c("BUILDING_CLASS_FINAL_ROLL"="X.BUILDING_CODE_ID"))

filter <-
combine1 %>%
filter(TYPE=="RESIDENTIAL")

combine2<-
history %>%
left_join(y=neighboorhood, by= "NEIGHBORHOOD_ID" )

filter3<-
combine2%>%
filter(NEIGHBORHOOD_NAME=="ASTORIA")%>%
group_by(SALE_DATE)

table5<-
filter3 %>%
select(ZIP_CODE,SALE_PRICE,GROSS_SQUARE_FEET) %>%
group_by (ZIP_CODE)

gross1<-
table5%>%
filter(GROSS_SQUARE_FEET>0)
gross1

gross<-summarise(table5, mean(SALE_PRICE/GROSS_SQUARE_FEET))
gross

1 " 0" NaN
2 "10128" Inf
3 "11001" NaN
4 "11006" Inf
5 "11101" NaN
6 "11102" NA
7 "11103" NA
8 "11104" 73.8
9 "11105" NaN
10 "11106" NA
11 "11361" 257.
12 "11363" NaN
13 "11370" NaN
14 "11375" Inf
15 "11377" Inf
16 "11422" Inf

That's my output, can anyone help me why am I getting NA or NAN, and if you explain what it means?

Thank you so much for your help!

`Inf` means infinity, `NaN` means not a number and `NA` means a missing value and, not visible in the output but closely related `NULL` means undefined.

There's no guarantee that these will go away after `SALE_PRICE` is converted from class character to class numeric, but that would be a good start.

@technocrat Thanks a lot for your help!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.