I have csv files imported in r each with 2 columns and many many rows. I have sorted the data in them but want to extract some values. The first column is an ID The second is a p-value ( now sorted in increasing order with NA's last) I want to extract the rows with a p-value of less than 0.05) What commands would help the table is called AnovaSort with column headings MCI & p-value Many thanks in advance
Help- extracting values
4 messages · Amit Patel, PIKAL Petr, David Winsemius
Petr Pikal petr.pikal at precheza.cz 724008364, 581252140, 581252257 r-help-bounces at r-project.org napsal dne 16.04.2009 16:45:15:
I have csv files imported in r each with 2 columns and many many rows. I
have
sorted the data in them but want to extract some values. The first column is an ID The second is a p-value ( now sorted in increasing order with NA's last) I want to extract the rows with a p-value of less than 0.05)
dd<-data.frame(runif(20), runif(20)) names(dd)<-c(letters[1:2]) dd[18:20,2]<-NA values greater than .8 with NA values
dd[dd$b>.8,]
a b 2 0.8288003 0.8263982 4 0.9292447 0.9331695 8 0.5084216 0.8637391 10 0.1316669 0.9742467 14 0.4024661 0.8195820 15 0.5192755 0.8756094 17 0.7339971 0.8266932 NA NA NA NA.1 NA NA NA.2 NA NA and without them
na.omit(dd[dd$b>.8,])
a b 2 0.8288003 0.8263982 4 0.9292447 0.9331695 8 0.5084216 0.8637391 10 0.1316669 0.9742467 14 0.4024661 0.8195820 15 0.5192755 0.8756094 17 0.7339971 0.8266932 Regards Petr
What commands would help the table is called AnovaSort with column headings MCI & p-value Many thanks in advance
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
On Apr 16, 2009, at 10:45 AM, Amit Patel wrote:
I have csv files imported in r each with 2 columns and many many rows. I have sorted the data in them but want to extract some values. The first column is an ID The second is a p-value ( now sorted in increasing order with NA's last) I want to extract the rows with a p-value of less than 0.05) What commands would help the table is called AnovaSort with column headings MCI & p-value
"p-value" is a rather unlikely R name for a column since it is illegal in R. Using a "table" is also unlikely, so let's assume that once you have read it into a dataframe, that it's named p_value. AnovaSort[AnovaSort$p_value < 0.05] David Winsemius, MD Heritage Laboratories West Hartford, CT
On Apr 16, 2009, at 11:10 AM, David Winsemius wrote:
On Apr 16, 2009, at 10:45 AM, Amit Patel wrote:
I have csv files imported in r each with 2 columns and many many rows. I have sorted the data in them but want to extract some values. The first column is an ID The second is a p-value ( now sorted in increasing order with NA's last) I want to extract the rows with a p-value of less than 0.05) What commands would help the table is called AnovaSort with column headings MCI & p-value
"p-value" is a rather unlikely R name for a column since it is illegal in R. Using a "table" is also unlikely, so let's assume that once you have read it into a dataframe, that it's named p_value. AnovaSort[AnovaSort$p_value < 0.05]
Missed a comma: novaSort[AnovaSort$p_value < 0.05,]
David Winsemius, MD Heritage Laboratories West Hartford, CT
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
David Winsemius, MD Heritage Laboratories West Hartford, CT