Hello, I am trying to select the following headers from a data frame but when I try and run the command it executes halfway through and give me an error at V188 and V359. Temp <- data.frame(V4, V5, V6, V7, V8, V9, V10, V11, V12, V13, V14, V15, V16, V17, V18, V19, V20, V21, V22, V23, V24, V25, V26, V27, V28, V29, V30, V31, V32, V33, V34, V35, V36, V37, V38, V39, V40, V41, V42, V43, V44, V45, V46, V47, V48, V49, V50, V51, V52, V53, V54, V55, V56, V57, V58, V59, V60, V61, V62, V63, V64, V65, V66, V67, V68, V69, V70, V71, V72, V73, V74, V75, V76, V77, V78, V79, V80, V81, V82, V83, V84, V85, V86, V87, V88, V89, V90, V91, V92, V93, V94, V95, V96, V97, V98, V99, V100, V101, V102, V103, V104, V105, V106, V107, V108, V109, V110, V111, V112, V113, V114, V115, V116, V117, V118, V119, V120, V121, V122, V123, V124, V125, V126, V127, V128, V129, V130, V131, V132, V133, V134, V135, V136, V137, V138, V139, V140, V141, V142, V143, V144, V145, V146, V147, V148, V149, V150, V151, V152, V153, V154, V155, V156, V157, V158, V159, V160, V161, V162, V163, V164, V165, V166, V167, V168, V169, V170, V171, V172, V173, V174, V175, V176, V177, V178, V179, V180, V181, V182, V183, V184, V185, V186, V187, V188, V189, V190, V191, V192, V193, V194, V195, V196, V197, V198, V199, V200, V201, V202, V203, V204, V205, V206, V207, V208, V209, V210, V211, V212, V213, V214, V215, V216, V217, V218, V219, V220, V221, V222, V223, V224, V225, V226, V227, V228, V229, V230, V231, V232, V233, V234, V235, V236, V237, V238, V239, V240, V241, V242, V243, V244, V245, V246, V247, V248, V249, V250, V251, V252, V253, V254, V255, V256, V257, V258, V259, V260, V261, V262, V263, V264, V265, V266, V267, V268, V269, V270, V271, V272, V273, V274, V275, V276, V277, V278, V279, V280, V281, V282, V283, V284, V285, V286, V287, V288, V289, V290, V291, V292, V293, V294, V295, V296, V297, V298, V299, V300, V301, V302, V303, V304, V305, V306, V307, V308, V309, V310, V311, V312, V313, V314, V315, V316, V317, V318, V319, V320, V321, V322, V323, V324, V325, V326, V327, V328, V329, V330, V331, V332, V333, V334, V335, V336, V337, V338, V339, V340, V341, V342, V343, V344, V345, V346, V347, V348, V349, V350, V351, V352, V353, V354, V355, V356, V357, V358, V359, V360, V361, V362, V363, V364, V365, V366, V367, V368) Is there a way to shorten this long line of code or a way to solve the problem? Thanks R -- View this message in context: http://www.nabble.com/long-data-frame-selection-error-tp18455101p18455101.html Sent from the R help mailing list archive at Nabble.com.
Seems to work fine for me. Short version is at the end:> for (i in 4:368){+ assign(paste("V", i, sep=''), 1:10) + }> Temp <- data.frame(V4, V5, V6, V7, V8, V9, V10, V11, V12, V13, V14, V15,+ V16, V17, V18, V19, V20, V21, V22, V23, V24, V25, V26, V27, V28, V29, V30, + V31, V32, V33, V34, V35, V36, V37, V38, V39, V40, V41, V42, V43, V44, V45, + V46, V47, V48, V49, V50, V51, V52, V53, V54, V55, V56, V57, V58, V59, V60, + V61, V62, V63, V64, V65, V66, V67, V68, V69, V70, V71, V72, V73, V74, V75, + V76, V77, V78, V79, V80, V81, V82, V83, V84, V85, V86, V87, V88, V89, V90, + V91, V92, V93, V94, V95, V96, V97, V98, V99, V100, V101, V102, V103, V104, + V105, V106, V107, V108, V109, V110, V111, V112, V113, V114, V115, V116, + V117, V118, V119, V120, V121, V122, V123, V124, V125, V126, V127, V128, + V129, V130, V131, V132, V133, V134, V135, V136, V137, V138, V139, V140, + V141, V142, V143, V144, V145, V146, V147, V148, V149, V150, V151, V152, + V153, V154, V155, V156, V157, V158, V159, V160, V161, V162, V163, V164, + V165, V166, V167, V168, V169, V170, V171, V172, V173, V174, V175, V176, + V177, V178, V179, V180, V181, V182, V183, V184, V185, V186, V187, V188, + V189, V190, V191, V192, V193, V194, V195, V196, V197, V198, V199, V200, + V201, V202, V203, V204, V205, V206, V207, V208, V209, V210, V211, V212, + V213, V214, V215, V216, V217, V218, V219, V220, V221, V222, V223, V224, + V225, V226, V227, V228, V229, V230, V231, V232, V233, V234, V235, V236, + V237, V238, V239, V240, V241, V242, V243, V244, V245, V246, V247, V248, + V249, V250, V251, V252, V253, V254, V255, V256, V257, V258, V259, V260, + V261, V262, V263, V264, V265, V266, V267, V268, V269, V270, V271, V272, + V273, V274, V275, V276, V277, V278, V279, V280, V281, V282, V283, V284, + V285, V286, V287, V288, V289, V290, V291, V292, V293, V294, V295, V296, + V297, V298, V299, V300, V301, V302, V303, V304, V305, V306, V307, V308, + V309, V310, V311, V312, V313, V314, V315, V316, V317, V318, V319, V320, + V321, V322, V323, V324, V325, V326, V327, V328, V329, V330, V331, V332, + V333, V334, V335, V336, V337, V338, V339, V340, V341, V342, V343, V344, + V345, V346, V347, V348, V349, V350, V351, V352, V353, V354, V355, V356, + V357, V358, V359, V360, V361, V362, V363, V364, V365, V366, V367, V368)> > # short version > # list of names > z <- lapply(paste("V", 4:368, sep=""), as.name) > temp <- do.call(data.frame, z) > identical(temp,Temp)[1] TRUE> > >On Mon, Jul 14, 2008 at 7:07 PM, Rheannon <rbrooks at uvic.ca> wrote:> > Hello, > > I am trying to select the following headers from a data frame but when I try > and run the command it executes halfway through and give me an error at V188 > and V359. > > Temp <- data.frame(V4, V5, V6, V7, V8, V9, V10, V11, V12, V13, V14, V15, > V16, V17, V18, V19, V20, V21, V22, V23, V24, V25, V26, V27, V28, V29, V30, > V31, V32, V33, V34, V35, V36, V37, V38, V39, V40, V41, V42, V43, V44, V45, > V46, V47, V48, V49, V50, V51, V52, V53, V54, V55, V56, V57, V58, V59, V60, > V61, V62, V63, V64, V65, V66, V67, V68, V69, V70, V71, V72, V73, V74, V75, > V76, V77, V78, V79, V80, V81, V82, V83, V84, V85, V86, V87, V88, V89, V90, > V91, V92, V93, V94, V95, V96, V97, V98, V99, V100, V101, V102, V103, V104, > V105, V106, V107, V108, V109, V110, V111, V112, V113, V114, V115, V116, > V117, V118, V119, V120, V121, V122, V123, V124, V125, V126, V127, V128, > V129, V130, V131, V132, V133, V134, V135, V136, V137, V138, V139, V140, > V141, V142, V143, V144, V145, V146, V147, V148, V149, V150, V151, V152, > V153, V154, V155, V156, V157, V158, V159, V160, V161, V162, V163, V164, > V165, V166, V167, V168, V169, V170, V171, V172, V173, V174, V175, V176, > V177, V178, V179, V180, V181, V182, V183, V184, V185, V186, V187, V188, > V189, V190, V191, V192, V193, V194, V195, V196, V197, V198, V199, V200, > V201, V202, V203, V204, V205, V206, V207, V208, V209, V210, V211, V212, > V213, V214, V215, V216, V217, V218, V219, V220, V221, V222, V223, V224, > V225, V226, V227, V228, V229, V230, V231, V232, V233, V234, V235, V236, > V237, V238, V239, V240, V241, V242, V243, V244, V245, V246, V247, V248, > V249, V250, V251, V252, V253, V254, V255, V256, V257, V258, V259, V260, > V261, V262, V263, V264, V265, V266, V267, V268, V269, V270, V271, V272, > V273, V274, V275, V276, V277, V278, V279, V280, V281, V282, V283, V284, > V285, V286, V287, V288, V289, V290, V291, V292, V293, V294, V295, V296, > V297, V298, V299, V300, V301, V302, V303, V304, V305, V306, V307, V308, > V309, V310, V311, V312, V313, V314, V315, V316, V317, V318, V319, V320, > V321, V322, V323, V324, V325, V326, V327, V328, V329, V330, V331, V332, > V333, V334, V335, V336, V337, V338, V339, V340, V341, V342, V343, V344, > V345, V346, V347, V348, V349, V350, V351, V352, V353, V354, V355, V356, > V357, V358, V359, V360, V361, V362, V363, V364, V365, V366, V367, V368) > > Is there a way to shorten this long line of code or a way to solve the > problem? > > Thanks > R > -- > View this message in context: http://www.nabble.com/long-data-frame-selection-error-tp18455101p18455101.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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. >-- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve?
You are not selecting the headers (column names)of a dataframe. You seem to be creating a new data.frame consisting of those names. It should give you a 1Xn dataframe. Is that what you intended to do? What errors message do you get at V188? --- On Mon, 7/14/08, Rheannon <rbrooks at uvic.ca> wrote:> From: Rheannon <rbrooks at uvic.ca> > Subject: [R] long data frame selection error > To: r-help at r-project.org > Received: Monday, July 14, 2008, 7:07 PM > Hello, > > I am trying to select the following headers from a data > frame but when I try > and run the command it executes halfway through and give me > an error at V188 > and V359. > > Temp <- data.frame(V4, V5, V6, V7, V8, V9, V10, V11, > V12, V13, V14, V15, > V16, V17, V18, V19, V20, V21, V22, V23, V24, V25, V26, V27, > V28, V29, V30, > V31, V32, V33, V34, V35, V36, V37, V38, V39, V40, V41, V42, > V43, V44, V45, > V46, V47, V48, V49, V50, V51, V52, V53, V54, V55, V56, V57, > V58, V59, V60, > V61, V62, V63, V64, V65, V66, V67, V68, V69, V70, V71, V72, > V73, V74, V75, > V76, V77, V78, V79, V80, V81, V82, V83, V84, V85, V86, V87, > V88, V89, V90, > V91, V92, V93, V94, V95, V96, V97, V98, V99, V100, V101, > V102, V103, V104, > V105, V106, V107, V108, V109, V110, V111, V112, V113, V114, > V115, V116, > V117, V118, V119, V120, V121, V122, V123, V124, V125, V126, > V127, V128, > V129, V130, V131, V132, V133, V134, V135, V136, V137, V138, > V139, V140, > V141, V142, V143, V144, V145, V146, V147, V148, V149, V150, > V151, V152, > V153, V154, V155, V156, V157, V158, V159, V160, V161, V162, > V163, V164, > V165, V166, V167, V168, V169, V170, V171, V172, V173, V174, > V175, V176, > V177, V178, V179, V180, V181, V182, V183, V184, V185, V186, > V187, V188, > V189, V190, V191, V192, V193, V194, V195, V196, V197, V198, > V199, V200, > V201, V202, V203, V204, V205, V206, V207, V208, V209, V210, > V211, V212, > V213, V214, V215, V216, V217, V218, V219, V220, V221, V222, > V223, V224, > V225, V226, V227, V228, V229, V230, V231, V232, V233, V234, > V235, V236, > V237, V238, V239, V240, V241, V242, V243, V244, V245, V246, > V247, V248, > V249, V250, V251, V252, V253, V254, V255, V256, V257, V258, > V259, V260, > V261, V262, V263, V264, V265, V266, V267, V268, V269, V270, > V271, V272, > V273, V274, V275, V276, V277, V278, V279, V280, V281, V282, > V283, V284, > V285, V286, V287, V288, V289, V290, V291, V292, V293, V294, > V295, V296, > V297, V298, V299, V300, V301, V302, V303, V304, V305, V306, > V307, V308, > V309, V310, V311, V312, V313, V314, V315, V316, V317, V318, > V319, V320, > V321, V322, V323, V324, V325, V326, V327, V328, V329, V330, > V331, V332, > V333, V334, V335, V336, V337, V338, V339, V340, V341, V342, > V343, V344, > V345, V346, V347, V348, V349, V350, V351, V352, V353, V354, > V355, V356, > V357, V358, V359, V360, V361, V362, V363, V364, V365, V366, > V367, V368) > > Is there a way to shorten this long line of code or a way > to solve the > problem? > > Thanks > R > -- > View this message in context: > http://www.nabble.com/long-data-frame-selection-error-tp18455101p18455101.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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.