Hello all! I have a problem to extract values greater that for example 1820. I try this code: x[x[,1]>1820,]->x1 Please help me! Thank you! The data structure is: structure(c(2.576, 1.728, 3.434, 2.187, 1.928, 1.886, 1.2425, 1.23, 1.075, 1.1785, 1.186, 1.165, 1.732, 1.517, 1.4095, 1.074, 1.618, 1.677, 1.845, 1.594, 1.6655, 1.1605, 1.425, 1.099, 1.007, 1.1795, 1.3855, 1.4065, 1.138, 1.514, 1.4605, 1.756, 1.4165, 1.22, 1.825, 1.8365, 1.81, 1.818, 2.1085, 2.233, 2.5605, 2.285, 2.821, 2.16, 1.914, 1.747, 2.031, 1.847, 1.7715, 1.7925, 1.651, 1.4345, 1.291, 1.9895, 1.99, 1.73, 1.912, 1.776, 1.596, 1.6915, 1.8245, 1.773, 2.173, 2.2345, 2.105, 1.922, 1.802, 1.6385, 1.6545, 2.1785, 1.868, 2.1855, 2.5175, 2.025, 2.435, 1.809, 1.628, 1.327, 1.3485, 1.4335, 2.052, 2.2465, 2.151, 1.7945, 1.79, 1.6055, 1.616, 1.633, 1.665, 2.002, 2.152, 1.736, 1.7985, 1.9155, 1.7135, 1.548, 1.568, 1.713, 2.079, 1.875, 2.12, 2.072, 1.906, 1.4645, 1.3025, 1.407, 1.5445, 1.437, 1.463, 1.5235, 1.609, 1.738, 1.478, 1.573, 1.0465, 1.429, 1.632, 1.814, 1.933, 1.63, 1.482, 1.466, 1.4025, 1.6055, 1.279, 1.827, 1.201, 1.425, 1.678, 1.5535, 1.599, 1.826, 1.964, 1.68, 1.492, 1.509, 1.666, 1.5665, 1.666, 1.4885, 1.8205, 1.5965, 1.84, 1.551, 1.4835, 1.805, 1.7145, 1.902, 1.2085, 0.9095, 0.9325, 1.34, 1.6135, 1.5825, 1.757, 1.7105, 1.3115, 1.288, 1.567, 1.7795, 1.642, 1.4375, 1.4495, 1.4225, 1.4885, 1.251, 1.179, 1.188, 1.3605, 1.373, 1.2185, 1.405, 1.016, 0.979, 1.018, 1.0335, 1.39, 1.3005, 1.3955, 1.301, 1.6475, 1.1945, 1.3215, 1.0535, 1.1645, 1.0895, 1.041, 1.155, 1.322, 1.1615, 0.933, 1.1215, 1.022, 0.922, 0.8465, 1.103, 1.1375, 1.23, 1.289, 1.222, 1.4865, 1.4025, 1.4295, 1.156, 0.9085, 0.8755, 0.9135, 0.982, 1.145, 1.1295, 1.3475, 1.2415, 1.2505), .Names = c("1799", "1800", "1801", "1802", "1803", "1804", "1805", "1806", "1807", "1808", "1809", "1810", "1811", "1812", "1813", "1814", "1815", "1816", "1817", "1818", "1819", "1820", "1821", "1822", "1823", "1824", "1825", "1826", "1827", "1828", "1829", "1830", "1831", "1832", "1833", "1834", "1835", "1836", "1837", "1838", "1839", "1840", "1841", "1842", "1843", "1844", "1845", "1846", "1847", "1848", "1849", "1850", "1851", "1852", "1853", "1854", "1855", "1856", "1857", "1858", "1859", "1860", "1861", "1862", "1863", "1864", "1865", "1866", "1867", "1868", "1869", "1870", "1871", "1872", "1873", "1874", "1875", "1876", "1877", "1878", "1879", "1880", "1881", "1882", "1883", "1884", "1885", "1886", "1887", "1888", "1889", "1890", "1891", "1892", "1893", "1894", "1895", "1896", "1897", "1898", "1899", "1900", "1901", "1902", "1903", "1904", "1905", "1906", "1907", "1908", "1909", "1910", "1911", "1912", "1913", "1914", "1915", "1916", "1917", "1918", "1919", "1920", "1921", "1922", "1923", "1924", "1925", "1926", "1927", "1928", "1929", "1930", "1931", "1932", "1933", "1934", "1935", "1936", "1937", "1938", "1939", "1940", "1941", "1942", "1943", "1944", "1945", "1946", "1947", "1948", "1949", "1950", "1951", "1952", "1953", "1954", "1955", "1956", "1957", "1958", "1959", "1960", "1961", "1962", "1963", "1964", "1965", "1966", "1967", "1968", "1969", "1970", "1971", "1972", "1973", "1974", "1975", "1976", "1977", "1978", "1979", "1980", "1981", "1982", "1983", "1984", "1985", "1986", "1987", "1988", "1989", "1990", "1991", "1992", "1993", "1994", "1995", "1996", "1997", "1998", "1999", "2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009", "2010", "2011")) -- --- Catalin-Constantin ROIBU Forestry engineer, PhD Forestry Faculty of Suceava Str. Universitatii no. 13, Suceava, 720229, Romania office phone +4 0230 52 29 78, ext. 531 mobile phone +4 0745 53 18 01 +4 0766 71 76 58 FAX: +4 0230 52 16 64 silvic.usv.ro [[alternative HTML version deleted]]
I guess you are referring to names() vec1# dataset ?vec1[names(vec1)>1820] head(vec1[names(vec1)>1820]) ?# 1821?? 1822?? 1823?? 1824?? 1825?? 1826 #1.4250 1.0990 1.0070 1.1795 1.3855 1.4065 A.K. ----- Original Message ----- From: catalin roibu <catalinroibu at gmail.com> To: r-help at r-project.org Cc: Sent: Tuesday, March 12, 2013 1:50 PM Subject: [R] extract values Hello all! I have a problem to extract values greater that for example 1820. I try this code: x[x[,1]>1820,]->x1 Please help me! Thank you! The data structure is: structure(c(2.576, 1.728, 3.434, 2.187, 1.928, 1.886, 1.2425, 1.23, 1.075, 1.1785, 1.186, 1.165, 1.732, 1.517, 1.4095, 1.074, 1.618, 1.677, 1.845, 1.594, 1.6655, 1.1605, 1.425, 1.099, 1.007, 1.1795, 1.3855, 1.4065, 1.138, 1.514, 1.4605, 1.756, 1.4165, 1.22, 1.825, 1.8365, 1.81, 1.818, 2.1085, 2.233, 2.5605, 2.285, 2.821, 2.16, 1.914, 1.747, 2.031, 1.847, 1.7715, 1.7925, 1.651, 1.4345, 1.291, 1.9895, 1.99, 1.73, 1.912, 1.776, 1.596, 1.6915, 1.8245, 1.773, 2.173, 2.2345, 2.105, 1.922, 1.802, 1.6385, 1.6545, 2.1785, 1.868, 2.1855, 2.5175, 2.025, 2.435, 1.809, 1.628, 1.327, 1.3485, 1.4335, 2.052, 2.2465, 2.151, 1.7945, 1.79, 1.6055, 1.616, 1.633, 1.665, 2.002, 2.152, 1.736, 1.7985, 1.9155, 1.7135, 1.548, 1.568, 1.713, 2.079, 1.875, 2.12, 2.072, 1.906, 1.4645, 1.3025, 1.407, 1.5445, 1.437, 1.463, 1.5235, 1.609, 1.738, 1.478, 1.573, 1.0465, 1.429, 1.632, 1.814, 1.933, 1.63, 1.482, 1.466, 1.4025, 1.6055, 1.279, 1.827, 1.201, 1.425, 1.678, 1.5535, 1.599, 1.826, 1.964, 1.68, 1.492, 1.509, 1.666, 1.5665, 1.666, 1.4885, 1.8205, 1.5965, 1.84, 1.551, 1.4835, 1.805, 1.7145, 1.902, 1.2085, 0.9095, 0.9325, 1.34, 1.6135, 1.5825, 1.757, 1.7105, 1.3115, 1.288, 1.567, 1.7795, 1.642, 1.4375, 1.4495, 1.4225, 1.4885, 1.251, 1.179, 1.188, 1.3605, 1.373, 1.2185, 1.405, 1.016, 0.979, 1.018, 1.0335, 1.39, 1.3005, 1.3955, 1.301, 1.6475, 1.1945, 1.3215, 1.0535, 1.1645, 1.0895, 1.041, 1.155, 1.322, 1.1615, 0.933, 1.1215, 1.022, 0.922, 0.8465, 1.103, 1.1375, 1.23, 1.289, 1.222, 1.4865, 1.4025, 1.4295, 1.156, 0.9085, 0.8755, 0.9135, 0.982, 1.145, 1.1295, 1.3475, 1.2415, 1.2505), .Names = c("1799", "1800", "1801", "1802", "1803", "1804", "1805", "1806", "1807", "1808", "1809", "1810", "1811", "1812", "1813", "1814", "1815", "1816", "1817", "1818", "1819", "1820", "1821", "1822", "1823", "1824", "1825", "1826", "1827", "1828", "1829", "1830", "1831", "1832", "1833", "1834", "1835", "1836", "1837", "1838", "1839", "1840", "1841", "1842", "1843", "1844", "1845", "1846", "1847", "1848", "1849", "1850", "1851", "1852", "1853", "1854", "1855", "1856", "1857", "1858", "1859", "1860", "1861", "1862", "1863", "1864", "1865", "1866", "1867", "1868", "1869", "1870", "1871", "1872", "1873", "1874", "1875", "1876", "1877", "1878", "1879", "1880", "1881", "1882", "1883", "1884", "1885", "1886", "1887", "1888", "1889", "1890", "1891", "1892", "1893", "1894", "1895", "1896", "1897", "1898", "1899", "1900", "1901", "1902", "1903", "1904", "1905", "1906", "1907", "1908", "1909", "1910", "1911", "1912", "1913", "1914", "1915", "1916", "1917", "1918", "1919", "1920", "1921", "1922", "1923", "1924", "1925", "1926", "1927", "1928", "1929", "1930", "1931", "1932", "1933", "1934", "1935", "1936", "1937", "1938", "1939", "1940", "1941", "1942", "1943", "1944", "1945", "1946", "1947", "1948", "1949", "1950", "1951", "1952", "1953", "1954", "1955", "1956", "1957", "1958", "1959", "1960", "1961", "1962", "1963", "1964", "1965", "1966", "1967", "1968", "1969", "1970", "1971", "1972", "1973", "1974", "1975", "1976", "1977", "1978", "1979", "1980", "1981", "1982", "1983", "1984", "1985", "1986", "1987", "1988", "1989", "1990", "1991", "1992", "1993", "1994", "1995", "1996", "1997", "1998", "1999", "2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009", "2010", "2011")) -- --- Catalin-Constantin ROIBU Forestry engineer, PhD Forestry Faculty of Suceava Str. Universitatii no. 13, Suceava, 720229, Romania office phone? ? +4 0230 52 29 78, ext. 531 mobile phone? +4 0745 53 18 01 ? ? ? ? ? ? ? ? ? ? ? +4 0766 71 76 58 FAX:? ? ? ? ? ? ? ? +4 0230 52 16 64 silvic.usv.ro ??? [[alternative HTML version deleted]] ______________________________________________ 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.
First take a look at your data and understand its structure. What you have is a named vector and not a matrix:> str(x)Named num [1:213] 2.58 1.73 3.43 2.19 1.93 ... - attr(*, "names")= chr [1:213] "1799" "1800" "1801" "1802" ...> x1 <- x[names(x) > '1820'] > x11821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1.4250 1.0990 1.0070 1.1795 1.3855 1.4065 1.1380 1.5140 1.4605 1.7560 1.4165 1.2200 1.8250 1.8365 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1.8100 1.8180 2.1085 2.2330 2.5605 2.2850 2.8210 2.1600 1.9140 1.7470 2.0310 1.8470 1.7715 1.7925 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1.6510 1.4345 1.2910 1.9895 1.9900 1.7300 1.9120 1.7760 1.5960 1.6915 1.8245 1.7730 2.1730 2.2345 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 On Tue, Mar 12, 2013 at 1:50 PM, catalin roibu <catalinroibu@gmail.com>wrote:> Hello all! > I have a problem to extract values greater that for example 1820. > I try this code: x[x[,1]>1820,]->x1 > Please help me! > > Thank you! > > The data structure is: > structure(c(2.576, 1.728, 3.434, 2.187, 1.928, 1.886, 1.2425, > 1.23, 1.075, 1.1785, 1.186, 1.165, 1.732, 1.517, 1.4095, 1.074, > 1.618, 1.677, 1.845, 1.594, 1.6655, 1.1605, 1.425, 1.099, 1.007, > 1.1795, 1.3855, 1.4065, 1.138, 1.514, 1.4605, 1.756, 1.4165, > 1.22, 1.825, 1.8365, 1.81, 1.818, 2.1085, 2.233, 2.5605, 2.285, > 2.821, 2.16, 1.914, 1.747, 2.031, 1.847, 1.7715, 1.7925, 1.651, > 1.4345, 1.291, 1.9895, 1.99, 1.73, 1.912, 1.776, 1.596, 1.6915, > 1.8245, 1.773, 2.173, 2.2345, 2.105, 1.922, 1.802, 1.6385, 1.6545, > 2.1785, 1.868, 2.1855, 2.5175, 2.025, 2.435, 1.809, 1.628, 1.327, > 1.3485, 1.4335, 2.052, 2.2465, 2.151, 1.7945, 1.79, 1.6055, 1.616, > 1.633, 1.665, 2.002, 2.152, 1.736, 1.7985, 1.9155, 1.7135, 1.548, > 1.568, 1.713, 2.079, 1.875, 2.12, 2.072, 1.906, 1.4645, 1.3025, > 1.407, 1.5445, 1.437, 1.463, 1.5235, 1.609, 1.738, 1.478, 1.573, > 1.0465, 1.429, 1.632, 1.814, 1.933, 1.63, 1.482, 1.466, 1.4025, > 1.6055, 1.279, 1.827, 1.201, 1.425, 1.678, 1.5535, 1.599, 1.826, > 1.964, 1.68, 1.492, 1.509, 1.666, 1.5665, 1.666, 1.4885, 1.8205, > 1.5965, 1.84, 1.551, 1.4835, 1.805, 1.7145, 1.902, 1.2085, 0.9095, > 0.9325, 1.34, 1.6135, 1.5825, 1.757, 1.7105, 1.3115, 1.288, 1.567, > 1.7795, 1.642, 1.4375, 1.4495, 1.4225, 1.4885, 1.251, 1.179, > 1.188, 1.3605, 1.373, 1.2185, 1.405, 1.016, 0.979, 1.018, 1.0335, > 1.39, 1.3005, 1.3955, 1.301, 1.6475, 1.1945, 1.3215, 1.0535, > 1.1645, 1.0895, 1.041, 1.155, 1.322, 1.1615, 0.933, 1.1215, 1.022, > 0.922, 0.8465, 1.103, 1.1375, 1.23, 1.289, 1.222, 1.4865, 1.4025, > 1.4295, 1.156, 0.9085, 0.8755, 0.9135, 0.982, 1.145, 1.1295, > 1.3475, 1.2415, 1.2505), .Names = c("1799", "1800", "1801", "1802", > "1803", "1804", "1805", "1806", "1807", "1808", "1809", "1810", > "1811", "1812", "1813", "1814", "1815", "1816", "1817", "1818", > "1819", "1820", "1821", "1822", "1823", "1824", "1825", "1826", > "1827", "1828", "1829", "1830", "1831", "1832", "1833", "1834", > "1835", "1836", "1837", "1838", "1839", "1840", "1841", "1842", > "1843", "1844", "1845", "1846", "1847", "1848", "1849", "1850", > "1851", "1852", "1853", "1854", "1855", "1856", "1857", "1858", > "1859", "1860", "1861", "1862", "1863", "1864", "1865", "1866", > "1867", "1868", "1869", "1870", "1871", "1872", "1873", "1874", > "1875", "1876", "1877", "1878", "1879", "1880", "1881", "1882", > "1883", "1884", "1885", "1886", "1887", "1888", "1889", "1890", > "1891", "1892", "1893", "1894", "1895", "1896", "1897", "1898", > "1899", "1900", "1901", "1902", "1903", "1904", "1905", "1906", > "1907", "1908", "1909", "1910", "1911", "1912", "1913", "1914", > "1915", "1916", "1917", "1918", "1919", "1920", "1921", "1922", > "1923", "1924", "1925", "1926", "1927", "1928", "1929", "1930", > "1931", "1932", "1933", "1934", "1935", "1936", "1937", "1938", > "1939", "1940", "1941", "1942", "1943", "1944", "1945", "1946", > "1947", "1948", "1949", "1950", "1951", "1952", "1953", "1954", > "1955", "1956", "1957", "1958", "1959", "1960", "1961", "1962", > "1963", "1964", "1965", "1966", "1967", "1968", "1969", "1970", > "1971", "1972", "1973", "1974", "1975", "1976", "1977", "1978", > "1979", "1980", "1981", "1982", "1983", "1984", "1985", "1986", > "1987", "1988", "1989", "1990", "1991", "1992", "1993", "1994", > "1995", "1996", "1997", "1998", "1999", "2000", "2001", "2002", > "2003", "2004", "2005", "2006", "2007", "2008", "2009", "2010", > "2011")) > > > -- > --- > Catalin-Constantin ROIBU > Forestry engineer, PhD > Forestry Faculty of Suceava > Str. Universitatii no. 13, Suceava, 720229, Romania > office phone +4 0230 52 29 78, ext. 531 > mobile phone +4 0745 53 18 01 > +4 0766 71 76 58 > FAX: +4 0230 52 16 64 > silvic.usv.ro > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@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. >-- Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. [[alternative HTML version deleted]]
Look at your data. You do not want values greater than 1820. There are none. You want values with NAMES greater than 1820.> x1 <- x[as.numeric(names(x)) >1820] > x1---------------------------------------------- David L Carlson Associate Professor of Anthropology Texas A&M University College Station, TX 77843-4352> -----Original Message----- > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r- > project.org] On Behalf Of catalin roibu > Sent: Tuesday, March 12, 2013 12:50 PM > To: r-help at r-project.org > Subject: [R] extract values > > Hello all! > I have a problem to extract values greater that for example 1820. > I try this code: x[x[,1]>1820,]->x1 > Please help me! > > Thank you! > > The data structure is: > structure(c(2.576, 1.728, 3.434, 2.187, 1.928, 1.886, 1.2425, > 1.23, 1.075, 1.1785, 1.186, 1.165, 1.732, 1.517, 1.4095, 1.074, > 1.618, 1.677, 1.845, 1.594, 1.6655, 1.1605, 1.425, 1.099, 1.007, > 1.1795, 1.3855, 1.4065, 1.138, 1.514, 1.4605, 1.756, 1.4165, > 1.22, 1.825, 1.8365, 1.81, 1.818, 2.1085, 2.233, 2.5605, 2.285, > 2.821, 2.16, 1.914, 1.747, 2.031, 1.847, 1.7715, 1.7925, 1.651, > 1.4345, 1.291, 1.9895, 1.99, 1.73, 1.912, 1.776, 1.596, 1.6915, > 1.8245, 1.773, 2.173, 2.2345, 2.105, 1.922, 1.802, 1.6385, 1.6545, > 2.1785, 1.868, 2.1855, 2.5175, 2.025, 2.435, 1.809, 1.628, 1.327, > 1.3485, 1.4335, 2.052, 2.2465, 2.151, 1.7945, 1.79, 1.6055, 1.616, > 1.633, 1.665, 2.002, 2.152, 1.736, 1.7985, 1.9155, 1.7135, 1.548, > 1.568, 1.713, 2.079, 1.875, 2.12, 2.072, 1.906, 1.4645, 1.3025, > 1.407, 1.5445, 1.437, 1.463, 1.5235, 1.609, 1.738, 1.478, 1.573, > 1.0465, 1.429, 1.632, 1.814, 1.933, 1.63, 1.482, 1.466, 1.4025, > 1.6055, 1.279, 1.827, 1.201, 1.425, 1.678, 1.5535, 1.599, 1.826, > 1.964, 1.68, 1.492, 1.509, 1.666, 1.5665, 1.666, 1.4885, 1.8205, > 1.5965, 1.84, 1.551, 1.4835, 1.805, 1.7145, 1.902, 1.2085, 0.9095, > 0.9325, 1.34, 1.6135, 1.5825, 1.757, 1.7105, 1.3115, 1.288, 1.567, > 1.7795, 1.642, 1.4375, 1.4495, 1.4225, 1.4885, 1.251, 1.179, > 1.188, 1.3605, 1.373, 1.2185, 1.405, 1.016, 0.979, 1.018, 1.0335, > 1.39, 1.3005, 1.3955, 1.301, 1.6475, 1.1945, 1.3215, 1.0535, > 1.1645, 1.0895, 1.041, 1.155, 1.322, 1.1615, 0.933, 1.1215, 1.022, > 0.922, 0.8465, 1.103, 1.1375, 1.23, 1.289, 1.222, 1.4865, 1.4025, > 1.4295, 1.156, 0.9085, 0.8755, 0.9135, 0.982, 1.145, 1.1295, > 1.3475, 1.2415, 1.2505), .Names = c("1799", "1800", "1801", "1802", > "1803", "1804", "1805", "1806", "1807", "1808", "1809", "1810", > "1811", "1812", "1813", "1814", "1815", "1816", "1817", "1818", > "1819", "1820", "1821", "1822", "1823", "1824", "1825", "1826", > "1827", "1828", "1829", "1830", "1831", "1832", "1833", "1834", > "1835", "1836", "1837", "1838", "1839", "1840", "1841", "1842", > "1843", "1844", "1845", "1846", "1847", "1848", "1849", "1850", > "1851", "1852", "1853", "1854", "1855", "1856", "1857", "1858", > "1859", "1860", "1861", "1862", "1863", "1864", "1865", "1866", > "1867", "1868", "1869", "1870", "1871", "1872", "1873", "1874", > "1875", "1876", "1877", "1878", "1879", "1880", "1881", "1882", > "1883", "1884", "1885", "1886", "1887", "1888", "1889", "1890", > "1891", "1892", "1893", "1894", "1895", "1896", "1897", "1898", > "1899", "1900", "1901", "1902", "1903", "1904", "1905", "1906", > "1907", "1908", "1909", "1910", "1911", "1912", "1913", "1914", > "1915", "1916", "1917", "1918", "1919", "1920", "1921", "1922", > "1923", "1924", "1925", "1926", "1927", "1928", "1929", "1930", > "1931", "1932", "1933", "1934", "1935", "1936", "1937", "1938", > "1939", "1940", "1941", "1942", "1943", "1944", "1945", "1946", > "1947", "1948", "1949", "1950", "1951", "1952", "1953", "1954", > "1955", "1956", "1957", "1958", "1959", "1960", "1961", "1962", > "1963", "1964", "1965", "1966", "1967", "1968", "1969", "1970", > "1971", "1972", "1973", "1974", "1975", "1976", "1977", "1978", > "1979", "1980", "1981", "1982", "1983", "1984", "1985", "1986", > "1987", "1988", "1989", "1990", "1991", "1992", "1993", "1994", > "1995", "1996", "1997", "1998", "1999", "2000", "2001", "2002", > "2003", "2004", "2005", "2006", "2007", "2008", "2009", "2010", > "2011")) > > > -- > --- > Catalin-Constantin ROIBU > Forestry engineer, PhD > Forestry Faculty of Suceava > Str. Universitatii no. 13, Suceava, 720229, Romania > office phone +4 0230 52 29 78, ext. 531 > mobile phone +4 0745 53 18 01 > +4 0766 71 76 58 > FAX: +4 0230 52 16 64 > silvic.usv.ro > > [[alternative HTML version deleted]] > > ______________________________________________ > 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.
Data in x is never > 1820:> summary(x)Min. 1st Qu. Median Mean 3rd Qu. Max. 0.8465 1.2890 1.5660 1.5710 1.8050 3.4340 And your object is a vector: trying to extract the first column with x[,1] is meaningless, because x has no dimensions.> dim(x)NULL It looks to me as if you want to extract values of x where the *names* are > 1820, but the names are character, so maybe: x1 <- x[as.numeric(names(x)) > 1820] is what you're looking for. Sarah On Tue, Mar 12, 2013 at 1:50 PM, catalin roibu <catalinroibu at gmail.com> wrote:> Hello all! > I have a problem to extract values greater that for example 1820. > I try this code: x[x[,1]>1820,]->x1 > Please help me! > > Thank you! > > The data structure is: > structure(c(2.576, 1.728, 3.434, 2.187, 1.928, 1.886, 1.2425, > 1.23, 1.075, 1.1785, 1.186, 1.165, 1.732, 1.517, 1.4095, 1.074, > 1.618, 1.677, 1.845, 1.594, 1.6655, 1.1605, 1.425, 1.099, 1.007, > 1.1795, 1.3855, 1.4065, 1.138, 1.514, 1.4605, 1.756, 1.4165, > 1.22, 1.825, 1.8365, 1.81, 1.818, 2.1085, 2.233, 2.5605, 2.285, > 2.821, 2.16, 1.914, 1.747, 2.031, 1.847, 1.7715, 1.7925, 1.651, > 1.4345, 1.291, 1.9895, 1.99, 1.73, 1.912, 1.776, 1.596, 1.6915, > 1.8245, 1.773, 2.173, 2.2345, 2.105, 1.922, 1.802, 1.6385, 1.6545, > 2.1785, 1.868, 2.1855, 2.5175, 2.025, 2.435, 1.809, 1.628, 1.327, > 1.3485, 1.4335, 2.052, 2.2465, 2.151, 1.7945, 1.79, 1.6055, 1.616, > 1.633, 1.665, 2.002, 2.152, 1.736, 1.7985, 1.9155, 1.7135, 1.548, > 1.568, 1.713, 2.079, 1.875, 2.12, 2.072, 1.906, 1.4645, 1.3025, > 1.407, 1.5445, 1.437, 1.463, 1.5235, 1.609, 1.738, 1.478, 1.573, > 1.0465, 1.429, 1.632, 1.814, 1.933, 1.63, 1.482, 1.466, 1.4025, > 1.6055, 1.279, 1.827, 1.201, 1.425, 1.678, 1.5535, 1.599, 1.826, > 1.964, 1.68, 1.492, 1.509, 1.666, 1.5665, 1.666, 1.4885, 1.8205, > 1.5965, 1.84, 1.551, 1.4835, 1.805, 1.7145, 1.902, 1.2085, 0.9095, > 0.9325, 1.34, 1.6135, 1.5825, 1.757, 1.7105, 1.3115, 1.288, 1.567, > 1.7795, 1.642, 1.4375, 1.4495, 1.4225, 1.4885, 1.251, 1.179, > 1.188, 1.3605, 1.373, 1.2185, 1.405, 1.016, 0.979, 1.018, 1.0335, > 1.39, 1.3005, 1.3955, 1.301, 1.6475, 1.1945, 1.3215, 1.0535, > 1.1645, 1.0895, 1.041, 1.155, 1.322, 1.1615, 0.933, 1.1215, 1.022, > 0.922, 0.8465, 1.103, 1.1375, 1.23, 1.289, 1.222, 1.4865, 1.4025, > 1.4295, 1.156, 0.9085, 0.8755, 0.9135, 0.982, 1.145, 1.1295, > 1.3475, 1.2415, 1.2505), .Names = c("1799", "1800", "1801", "1802", > "1803", "1804", "1805", "1806", "1807", "1808", "1809", "1810", > "1811", "1812", "1813", "1814", "1815", "1816", "1817", "1818", > "1819", "1820", "1821", "1822", "1823", "1824", "1825", "1826", > "1827", "1828", "1829", "1830", "1831", "1832", "1833", "1834", > "1835", "1836", "1837", "1838", "1839", "1840", "1841", "1842", > "1843", "1844", "1845", "1846", "1847", "1848", "1849", "1850", > "1851", "1852", "1853", "1854", "1855", "1856", "1857", "1858", > "1859", "1860", "1861", "1862", "1863", "1864", "1865", "1866", > "1867", "1868", "1869", "1870", "1871", "1872", "1873", "1874", > "1875", "1876", "1877", "1878", "1879", "1880", "1881", "1882", > "1883", "1884", "1885", "1886", "1887", "1888", "1889", "1890", > "1891", "1892", "1893", "1894", "1895", "1896", "1897", "1898", > "1899", "1900", "1901", "1902", "1903", "1904", "1905", "1906", > "1907", "1908", "1909", "1910", "1911", "1912", "1913", "1914", > "1915", "1916", "1917", "1918", "1919", "1920", "1921", "1922", > "1923", "1924", "1925", "1926", "1927", "1928", "1929", "1930", > "1931", "1932", "1933", "1934", "1935", "1936", "1937", "1938", > "1939", "1940", "1941", "1942", "1943", "1944", "1945", "1946", > "1947", "1948", "1949", "1950", "1951", "1952", "1953", "1954", > "1955", "1956", "1957", "1958", "1959", "1960", "1961", "1962", > "1963", "1964", "1965", "1966", "1967", "1968", "1969", "1970", > "1971", "1972", "1973", "1974", "1975", "1976", "1977", "1978", > "1979", "1980", "1981", "1982", "1983", "1984", "1985", "1986", > "1987", "1988", "1989", "1990", "1991", "1992", "1993", "1994", > "1995", "1996", "1997", "1998", "1999", "2000", "2001", "2002", > "2003", "2004", "2005", "2006", "2007", "2008", "2009", "2010", > "2011")) >-- Sarah Goslee http://www.functionaldiversity.org
Hello, I don't understand. Your object is a vector, with a dim attribute, so x[, 1] is meaningless. And all the values are less than 1820: any(x > 1820) # FALSE Given the names attribute of your data, is it the values of x corresponding to names greater than 1820? If so, try y <- as.numeric(names(x)) x[y > 1820] Hope this helps, Rui Barradas Em 12-03-2013 17:50, catalin roibu escreveu:> Hello all! > I have a problem to extract values greater that for example 1820. > I try this code: x[x[,1]>1820,]->x1 > Please help me! > > Thank you! > > The data structure is: > structure(c(2.576, 1.728, 3.434, 2.187, 1.928, 1.886, 1.2425, > 1.23, 1.075, 1.1785, 1.186, 1.165, 1.732, 1.517, 1.4095, 1.074, > 1.618, 1.677, 1.845, 1.594, 1.6655, 1.1605, 1.425, 1.099, 1.007, > 1.1795, 1.3855, 1.4065, 1.138, 1.514, 1.4605, 1.756, 1.4165, > 1.22, 1.825, 1.8365, 1.81, 1.818, 2.1085, 2.233, 2.5605, 2.285, > 2.821, 2.16, 1.914, 1.747, 2.031, 1.847, 1.7715, 1.7925, 1.651, > 1.4345, 1.291, 1.9895, 1.99, 1.73, 1.912, 1.776, 1.596, 1.6915, > 1.8245, 1.773, 2.173, 2.2345, 2.105, 1.922, 1.802, 1.6385, 1.6545, > 2.1785, 1.868, 2.1855, 2.5175, 2.025, 2.435, 1.809, 1.628, 1.327, > 1.3485, 1.4335, 2.052, 2.2465, 2.151, 1.7945, 1.79, 1.6055, 1.616, > 1.633, 1.665, 2.002, 2.152, 1.736, 1.7985, 1.9155, 1.7135, 1.548, > 1.568, 1.713, 2.079, 1.875, 2.12, 2.072, 1.906, 1.4645, 1.3025, > 1.407, 1.5445, 1.437, 1.463, 1.5235, 1.609, 1.738, 1.478, 1.573, > 1.0465, 1.429, 1.632, 1.814, 1.933, 1.63, 1.482, 1.466, 1.4025, > 1.6055, 1.279, 1.827, 1.201, 1.425, 1.678, 1.5535, 1.599, 1.826, > 1.964, 1.68, 1.492, 1.509, 1.666, 1.5665, 1.666, 1.4885, 1.8205, > 1.5965, 1.84, 1.551, 1.4835, 1.805, 1.7145, 1.902, 1.2085, 0.9095, > 0.9325, 1.34, 1.6135, 1.5825, 1.757, 1.7105, 1.3115, 1.288, 1.567, > 1.7795, 1.642, 1.4375, 1.4495, 1.4225, 1.4885, 1.251, 1.179, > 1.188, 1.3605, 1.373, 1.2185, 1.405, 1.016, 0.979, 1.018, 1.0335, > 1.39, 1.3005, 1.3955, 1.301, 1.6475, 1.1945, 1.3215, 1.0535, > 1.1645, 1.0895, 1.041, 1.155, 1.322, 1.1615, 0.933, 1.1215, 1.022, > 0.922, 0.8465, 1.103, 1.1375, 1.23, 1.289, 1.222, 1.4865, 1.4025, > 1.4295, 1.156, 0.9085, 0.8755, 0.9135, 0.982, 1.145, 1.1295, > 1.3475, 1.2415, 1.2505), .Names = c("1799", "1800", "1801", "1802", > "1803", "1804", "1805", "1806", "1807", "1808", "1809", "1810", > "1811", "1812", "1813", "1814", "1815", "1816", "1817", "1818", > "1819", "1820", "1821", "1822", "1823", "1824", "1825", "1826", > "1827", "1828", "1829", "1830", "1831", "1832", "1833", "1834", > "1835", "1836", "1837", "1838", "1839", "1840", "1841", "1842", > "1843", "1844", "1845", "1846", "1847", "1848", "1849", "1850", > "1851", "1852", "1853", "1854", "1855", "1856", "1857", "1858", > "1859", "1860", "1861", "1862", "1863", "1864", "1865", "1866", > "1867", "1868", "1869", "1870", "1871", "1872", "1873", "1874", > "1875", "1876", "1877", "1878", "1879", "1880", "1881", "1882", > "1883", "1884", "1885", "1886", "1887", "1888", "1889", "1890", > "1891", "1892", "1893", "1894", "1895", "1896", "1897", "1898", > "1899", "1900", "1901", "1902", "1903", "1904", "1905", "1906", > "1907", "1908", "1909", "1910", "1911", "1912", "1913", "1914", > "1915", "1916", "1917", "1918", "1919", "1920", "1921", "1922", > "1923", "1924", "1925", "1926", "1927", "1928", "1929", "1930", > "1931", "1932", "1933", "1934", "1935", "1936", "1937", "1938", > "1939", "1940", "1941", "1942", "1943", "1944", "1945", "1946", > "1947", "1948", "1949", "1950", "1951", "1952", "1953", "1954", > "1955", "1956", "1957", "1958", "1959", "1960", "1961", "1962", > "1963", "1964", "1965", "1966", "1967", "1968", "1969", "1970", > "1971", "1972", "1973", "1974", "1975", "1976", "1977", "1978", > "1979", "1980", "1981", "1982", "1983", "1984", "1985", "1986", > "1987", "1988", "1989", "1990", "1991", "1992", "1993", "1994", > "1995", "1996", "1997", "1998", "1999", "2000", "2001", "2002", > "2003", "2004", "2005", "2006", "2007", "2008", "2009", "2010", > "2011")) > >