[R] Auto Data in the ISLR Package
AbouEl-Makarim Aboueissa
abouelmakarim1962 at gmail.com
Sun Dec 17 13:12:30 CET 2017
Dear Eric:
Many Thanks
abou
______________________
*AbouEl-Makarim Aboueissa, PhD*
*Professor of Statistics*
*Department of Mathematics and Statistics*
*University of Southern Maine*
On Sun, Dec 17, 2017 at 5:25 AM, Eric Berger <ericjberger at gmail.com> wrote:
> myAuto <- Auto[ grep("ford|toyota",Auto$name),]
> myAuto$Make <- NA
> myAuto$Make[grep("ford",myAuto$name)] <- "Ford"
> myAuto$Make[grep("toyota",myAuto$name)] <- "Toyota"
>
> Regards,
> Eric
>
>
> On Sun, Dec 17, 2017 at 11:58 AM, AbouEl-Makarim Aboueissa <
> abouelmakarim1962 at gmail.com> wrote:
>
>> Dear Eric:
>>
>> Thank you very much. It works nicely.
>>
>> *Just one more thing;* how to create a new variable (say, *Make*) with *Make
>> = Ford* for the ford brand and *Make = T**oyota* for the toyota brand.
>>
>> Once again thank you all.
>>
>> abou
>>
>> ______________________
>>
>>
>> *AbouEl-Makarim Aboueissa, PhD*
>>
>> *Professor of Statistics*
>>
>> *Department of Mathematics and Statistics*
>> *University of Southern Maine*
>>
>>
>> On Sun, Dec 17, 2017 at 3:10 AM, Eric Berger <ericjberger at gmail.com>
>> wrote:
>>
>>> myAuto <- Auto[ grep("ford|toyota",Auto$name),]
>>>
>>>
>>>
>>> On Sat, Dec 16, 2017 at 10:28 PM, Bert Gunter <bgunter.4567 at gmail.com>
>>> wrote:
>>>
>>>> I did not care to load the packages -- small reproducible examples are
>>>> preferable, as the posting guide suggests.
>>>>
>>>> But, if I have understood correctly:
>>>>
>>>> See, e.g. ?subset
>>>>
>>>> Alternatively, you can read up on indexing data frames in any good
>>>> basic R
>>>> tutorial.
>>>>
>>>> Cheers,
>>>> Bert
>>>>
>>>> Bert Gunter
>>>>
>>>> "The trouble with having an open mind is that people keep coming along
>>>> and
>>>> sticking things into it."
>>>> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
>>>>
>>>> On Sat, Dec 16, 2017 at 11:44 AM, AbouEl-Makarim Aboueissa <
>>>> abouelmakarim1962 at gmail.com> wrote:
>>>>
>>>> > Dear All:
>>>> >
>>>> > I would like to create a subset data set *with only* all Ford and all
>>>> > Toyota cars from the Auto data set in ISLR R Package. Thank you
>>>> very much
>>>> > in advance.
>>>> >
>>>> > Please use the following code to see how is the data look like.
>>>> >
>>>> >
>>>> > install.packages("ISLR")
>>>> > library(ISLR)
>>>> > data(Auto)
>>>> > head(Auto)
>>>> >
>>>> >
>>>> > with many thanks
>>>> > abou
>>>> > ______________________
>>>> >
>>>> >
>>>> > *AbouEl-Makarim Aboueissa, PhD*
>>>> >
>>>> > *Professor of Statistics*
>>>> >
>>>> > *Department of Mathematics and Statistics*
>>>> > *University of Southern Maine*
>>>> >
>>>> > [[alternative HTML version deleted]]
>>>> >
>>>> > ______________________________________________
>>>> > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>>> > 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.
>>>> >
>>>>
>>>> [[alternative HTML version deleted]]
>>>>
>>>> ______________________________________________
>>>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>> PLEASE do read the posting guide http://www.R-project.org/posti
>>>> ng-guide.html
>>>> and provide commented, minimal, self-contained, reproducible code.
>>>>
>>>
>>>
>>
>
[[alternative HTML version deleted]]
More information about the R-help
mailing list