문제

I am working with a large data frame (see example below), where a value is missing in the year variable. I assume that the missing value is 2000 and i would like to add it. I don't like the idea to add the value by hand, is there any other possibility?

    dataID dataOrigin year breedSummary breedFCI SNP sex age postcode 
1 H00-0012  IVPZ-APPX 2000         1018        3   7   1  12     7000           
4 H00-0022  IVPZ-APPX NA           1217        1   5   3   9     7514

Many thanks!

도움이 되었습니까?

해결책 2

data$year[which (data$dataID == 'H00-0022’)]<- 2000

다른 팁

Assuming column dataID has unique variables, this can be done simply with:

data[data$dataID == 'H00-0022',]$year = 2000
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top