I am new in this and i am stuck. I have a list of data frames that have information about pressure, temperature and salinity. I want to subset all of them and keep only the values of temperature and salinity when the pressure is equal to 5. Below this is the structure of the list:
str(CT_STP)
List of 3
$ CT01_CTD1:'data.frame': 41 obs. of 3 variables:
..$ pressure : num [1:41] 1 2 3 4 5 6 7 8 9 10 ...
..$ temperature: num [1:41] 18.8 18.8 18.8 18.8 18.8 ...
..$ salinity : num [1:41] 34.1 34.1 34.1 34.1 34.1 ...
$ CT02_CTD1:'data.frame': 69 obs. of 3 variables:
..$ pressure : num [1:69] 2 3 4 5 6 7 8 9 10 11 ...
..$ temperature: num [1:69] 18.7 18.7 18.7 18.7 18.7 ...
..$ salinity : num [1:69] 34 34 34 34 34 ...
$ CT03_CTD1:'data.frame': 79 obs. of 3 variables:
..$ pressure : num [1:79] 1 2 3 4 5 6 7 8 9 10 ...
..$ temperature: num [1:79] 18.3 18.3 18.3 18.3 18.3 ...
..$ salinity : num [1:79] 33.9 33.9 33.9 33.9 33.9 ...
I want to subset all the data frames to get only the temperature and the salinity when the pressure is equal to five.
I´ve tried tonnes of things even this :
PROF5<-lapply(CT_STP,subset(CT_STP, pressure==5,select="pressure","temperature","salinity"))
but nothing seems to work so far... I have searched for answers here but its difficult to find specific ones being a newcomer.