Blogalia

"En el arte marcial como en la vida diaria. En la vida diaria como en un arte marcial."

Aikido

Sígueme en Twitter

<Agosto 2019
Lu Ma Mi Ju Vi Sa Do
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  
             


Todas las Historias

VELOCIDAD DE ESCAPE

Inicio > Historias > COSAS QUE NUNCA TE DIJE, EN R. (1)

2016-06-15

COSAS QUE NUNCA TE DIJE, EN R. (1)

Cuando llevas un tiempo pegándote con esto del Data Science, que es, a decir de los entendidos, lo que yo hago aunque lleve haciéndolo desde casi el siglo pasado, entonces bajo otros nombres, terminas llegando a R.

Y es lógico, pues se trata del lenguaje más útil que puedes aprender si lidias con datos. R está muy arriba, sólo en la cúspide, con el SQL a muy corta distancia, y un poco más atrás Python.

Dedicarse a esto y no conocer SQL y R es como pretender correr una maratón con grilletes en ambos pies. Mejor dedícate a otra cosa. Llegarás tarde, llegarás mal, y llegarás magullado.

Ya hace casi dos años que topé con este maravilloso, potente, fascinante (se me acaban los adjetivos) lenguaje, y no puedo hacer más que recomendarlo.
Al principio con timidez, y en la última época intensivamente, lo uso a diario, y a diario también, me sorprende con cosas nuevas.
A diario. ¿de cuántos lenguajes se puede decir lo mismo?

Como todo nuevo lenguaje, al principio te toca "pelearte" con ciertos comportamientos "extraños", que no vienen sino a ser peculiaridades del propio lenguaje,
y que pronto comienzas a reconocer, como cuando se reconoce a un viejo amigo. Sin embargo, estas pequeñas "peleas" no aparecen en los ejemplos ni en los tutoriales de la web.
Te quitan no pocas horas, pero son cosas tan elementales o al margen del objetivo central de un proyecto que se obvian o no se suelen mencionar y siempre eché de menos que alguien me hubiese echado una mano en esos momentos.

Pues aquí va mi aportación. Esta serie se denomina: "Cosas que nunca te dije. En R"

Lo habitual cuando manipulas tus datos y estás en una fase inicial, es que de todo el set de datos, en un momento dado deseas quedarte con un conjunto reducido.
Esto en R se denomina "subsetting", y es muy habitual.

Imaginemos un pequeño set de datos:

Generamos dos secuencias. Una de letras y otra de números y con ellas componemos el dataframe (objeto tabular básico de R)

df <- data.frame(letters=letters[1:5],numbers=seq(1:5))

 
df
 
letters numbers
1 a 1
2 b 2
3 c 3
4 d 4
5 e 5



Veamos los diferentes Levels de los Factores. Levels viene a ser el equivalente de UNIQUE ó DISTINCT y los Factores son aquellas columnas que almacenan valores categóricos, que pueden ser tanto numeros como cadenas de texto.


levels(df$letters)

[1] "a" "b" "c" "d" "e"


Hacemos un subsetting de las filas cuyo número sea mayor de 3

subdf <- subset(df, numbers <=3)

 
subdf
 
letters numbers
1 a 1
2 b 2
3 c 3

Y ahora viene lo bueno: Volvemos a mirar los Levels
levels(subdf$letters)

[1] "a" "b" "c" "d" "e"

¿¿CÓMO ES POSIBLE QUE SEAN LOS MISMOS ?? si hemos eliminado filas!!
Huelga decir que intentas hacer el subsetting de otras maneras, pero siempre terminas llegando a la misma conclusión: hago algo mal y no sé qué es.

Lo único que ocurre es que R conserva los Levels originales de un factor aunque hagamos subsetting.
Se soluciona habitualmente factorizando de nuevo o con droplevels

# factorizando

subdf$letters <- factor(subdf$letters)
 
# droplevels
subdf$letters <- droplevels(subdf$letters)
 
 
# et voilá
 
levels(subdf$letters)
[1] "a" "b" "c"

Programación | jomaweb | 29 Comentarios | Enlace


Referencias (TrackBacks)

URL de trackback de esta historia http://jomaweb.blogalia.com//trackbacks/76381

Comentarios

1
De: hotmail Fecha: 2018-09-10 07:22

https://hotmailde.de/www-hotmail-de-anmeldung/



2
De: Jim Harxmon Fecha: 2019-01-09 04:19

card games free



3
De: felix1seid Fecha: 2019-01-10 11:29

HP Printer Support
HP Computer Support
HP Laptop Support
HP Printer Customer Service
HP Printer Drivers
HP Printer Helpline
HP Printer Atlanta
HP Printer Baltimore MD
HP Printer Berkeley CA
HP Printer Boston
HP Printer Chicago
Dell Customer Service
Samsung Customer Service
Toshiba Customer Service
Panasonic Customer Service
Epson Customer Service
Sharp Customer Service
Printronix Customer Service
Lemark Customer Service
Canon Customer Service
HP Printer Repair Near Me
HP Printer Orange County
HP Printer Orlando
HP Printer Pasadena CA
HP Printer Phoenix
HP Printer Portland Oregon
HP Printer Raleigh NC
HP Printer Sacramento
HP Printer San Diego
HP Printer San Francisco
HP Printer San Jose
HP Printer Seattle
HP Printer St Louis MO
HP Printer Tulsa
HP Printer Vancouver WA
HP Printer Setup
HP Printer Harvey Norman
HP Sacnner Support
HP Support Phone Number
HP Printer Installation
The Customer Service Phone Number
About Us
Adt Customer Service
Air India Express Airlines Customer Service
Airasia India Customer Service
Airlines Customer Service
Alaska Airlines Customer Service
Allegiant Air Customer Service
Amazon Customer Service Number
Apple Customer Service Number
Atlas Air Customer Service
Att Business Customer Service Number
Att Customer Service Number
Att Email Customer Service
Bank Of America Customer Service Number
Banks Customer Service
Boost Mobile Customer Service Number
British Airways Customer Service Number
British Airways Executive Club Customer Service Number
British Airways Uk Customer Service Number
Cable Companies Customer Service
Car Rental Customer Service
Cathay Pacific Airlines Customer Service
Chase Customer Service Number
Citizens Bank Customer Service Number
Comcast Customer Service Number
Comcast Email Customer Service
Comcast Xfinity Home Security Systems Customer Service Number
Companies
Computer Customer Service
Consumer Service Customer Service
Contact Us
Delta Airlines Skymiles Customer Service Number
Delta Customer Service Number
Department Store Customer Service
Dish Network Customer Service Number
Ebay Customer Service Number
Email
Enterprise Rent A Car Customer Service Number
Envoy Air Customer Service
Equifax Customer Service Number
Etihad Airways Customer Service
Expedia Customer Service Number
Fedex Canada Customer Service Number
Fedex Customer Service Number
Fedex International Customer Service Number
Geico Customer Service Number
Godaddy Email Customer Service
Government Customer Service
Hertz Customer Service Number
Home Security
Hp Customer Service
Hulu Customer Service Number
Icloud Mail Customer Service
Incredimail Customer Service
Insurance Customer Service
Irs Customer Service Number
Jet Airways Customer Service
Jetblue Airlines Customer Service Number
Juno Email Customer Service
Kroger Customer Service Number
Lufthansa Airlines Customer Service
Macy Customer Service Number
Malaysia Airlines Customer Service
Medco Pharmacy Customer Service Number
Netflix Customer Service Number
Office 365 Email Customer Service
Outlook Email Customer Service
Paypal Customer Service Number
Pharmacy Customer Service
Phone Company Customer Service
Roadrunner Email Customer Service
Sbcglobal Email Customer Service
Shipping Customer Service
Shopping Customer Service
Singapore Airlines Customer Service
Skywest Airlines Customer Service
Spicejet Airlines Customer Service
Spirit Airline Customer Service
Sprint Customer Service Number
Store
Straight Talk Customer Service Number
Supermarket Customer Service
T Mobile Customer Service Number
Tech
Thai Airways Customer Service
Time Warner Cable Customer Service Number
Trujet Airlines Customer Service
Turkish Airlines Customer Service
Uber Customer Service Number
United Airlines Customer Service Number
Ups Customer Service Number
Ups Freight Customer Service Number
Ups Mail Innovations Customer Service Number
Ups Uk Customer Service Number
Verizon Customer Service Number
Verizon Email Customer Service
Virgin America Customer Service Number
Visa Customer Service Number
Vivint Customer Service
Wells Fargo Customer Service Number
Xfinity Email Customer Service
Yahoo Customer Service Number
Yahoo Email Customer Service
Zoho Mail Customer Service
Dell Customer Service
Samsung Customer Service
Toshiba Customer Service
Panasonic Customer Service
Epson Customer Service
Sharp Customer Service
Printronix Customer Service
Lemark Customer Service
Canon Customer Service
Printer Support
Apple Wireless Printer Support
Brother Printer Support
Canon Printer Support
Contact Printer Support
Dell Printer Support
Epson Printer Support
HP Printer Support
Kodak Printer Support
Konica Minolta Printer Support
Kyocera Printer Support
Lanier Printer Support
Lexmark Printer Support
OKI Printer Support
Panasonic Printer Support
Ricoh Printer Support
Samsung Printer Support
Sharp Printer Support
Toshiba Printer Support
Xerox Printer Support
Google Chrome Customer Service
Mozilla Firefox Customer Service
Opera Mini Customer Service
Safari Customer Service
Internet Explorer Customer Service
Seamonkey Customer Service
Microsoft Edge Customer Service
Netscape Browser Customer Service
UC Browser Customer Service
Slimjet Browser Customer Service



4
De: Independent Delhi Escorts Fecha: 2019-01-17 07:51

Myself Reva Datta I am a Model i am working as an independent escorts girl in Delhi NCR area.
Delhi Independent Escorts
Rajouri Garden Escorts
Saket Escorts
Escorts in Mahipalpur
Delhi Escorts
Aerocity Escorts
Karol Bagh Escorts
Independent Escorts in Delhi
Paharganj Escorts
Connaught Place Escorts
Noida Escorts
Vasant Kunj Escorts
Laxmi Nagar Escorts
Nehru Place Escorts



5
De: Escorts In Bangalore Fecha: 2019-01-28 10:48

--Bangalore Escorts--
--Escorts in Bangalore--
--Independent Escorts in Bangalore--
--Escorts in Delhi--
--Escorts in Bangalore--
--Escorts in Bangalore--
--VIP Escorts in Bangalore--
--Escorts in Bangalore--
--Escorts Services in Bangalore--
--Escorts in Bangalore--
--Escorts in Delhi--
--Escorts In Gurgaon--
--Escorts In Rohini--
--Escorts In bangalore--
--Escorts In Delhi--
--Escorts In Aerocity--
--Escorts In Dwarka--
--Escorts In Mahipalpur--
--Escorts In Noida--



6
De: Aisha Paal Fecha: 2019-02-03 09:45

At Aisha paal pune Escorts office, we have the best of magnificence, every one of our models is free pune escorts and they are too world class. You will see magnificence with class with our hot female pune Escorts.
Pune Escorts
Pune Escorts Girls
Escorts Service in Pune
Independent Pune Escorts
Female Pune Escorts
Escorts in Pune
Pune Escort Service
Female Escort in Pune
Picture gallery of Pune Escorts
Pune Escorts photos
real escort photos
Pune Escorts

Our Partner link :-
Pune Escorts
Pune Escort
Escorts in Pune
Escort in Pune
Escorts Pune
Escort Pune
Independent Pune Escorts
Female Pune Escorts
Best Pune Escorts
Pune Escorts Girls
Female Escort in Pune
Escorts service in Pune
Pune Escort services
Call Girls in Pune
Pune Escort Agency
Jaipur Escorts
Nashik Escorts



7
De: felix1seid Fecha: 2019-02-15 08:30

Air Canada Reservations



8
De: mumbai Fecha: 2019-03-06 11:26

You can benefit their administrations in Mumbai and furthermore adjacent spots. On the off chance that you are not in Mumbai and need to appreciate with Mumbai based call young ladies then you can simply book your arrangement. You can generally expect mind breaking administration given by call young ladies in Mumbai. They are actually quite benevolent and they realize great how to awe their customer.
Mumbai Independent Escorts
andheri Escorts
bandra Escorts services



9
De: mumbai escorts Fecha: 2019-03-13 04:47

Neha is an Mumbai Escorts. If you are looking forward to meeting the best Mumbai Call Girls for luxury services then Visit now - For more information Visit Our Website -
Mumbai Independent Escorts
female Escorts in mumbai
Andheri Escorts Services
Bandra Escorts Services
Vashi Escorts Services
Wadala Escorts Services
Juhu call girls
Mira road Escorts Services
Web Development Company
Free Technical Support



10
De: Best Night Clubs near me Fecha: 2019-03-19 11:03

I really enjoy simply reading all of your weblogs. Simply wanted to inform you that you have people like me who appreciate your work. Definitely a great post. Hats off to you! The information that you have provided is very helpful

Party Venue Fort Lauderdale
Latin Dance Clubs Kendall
Tapas Menu Lake Charles



11
De: mumbai escorts Fecha: 2019-03-23 09:01

Welcome to Mumbaihotcollection.com, home of the finest Mumbai escorts in Mumbai area. Our Mumbai escorts are the finest Mumbai has to offer and will provide an unforgettable Mumbai Escort experience!
Escorts in mumbai
Escort service in mumbai
Mumbai escorts
Mumbai call girls
Call girls in mumbai
Escorts mumbai
Mumbai escorts services
Gurgaon escorts
Independents mumbai escorts
Mumbai escorts independents
Mumbai Escorts services
Escort service in mumbai
Escorts in delhi
Escort service in delhi
delhi escorts service



12
De: Mumbai Escorts Fecha: 2019-03-26 17:51


Mumbai Escorts
Goa Escorts
Mumbai Escorts
coimbatore escorts
rajkot escorts services
goa escorts services
mire road escorts
andheri escorts
roku remote not working
mcafee.com/activate
escorts web development company
web development company in india



13
De: wertyuiop Fecha: 2019-03-29 14:34

SBCGlobal Customer Service Phone Number
SBCGlobal Customer Service
SBCGlobal Customer Service Number
SBCGlobal Customer Support
SBCGlobal Customer Support Phone Number
SBCGlobal Customer Support Number
SBCGlobal Helpline
SBCGlobal Help
SBCGlobal Phone Number
SBCGlobal Contact Number
AOL Customer Service
AOL Customer Service Phone Number
AOL customer service number
AOL customer service number
AOL customer support phone number
AOL customer suport number
AOL helpline
AOL help
AOL phone number
AOL contact number
Roadrunner Customer Service
Roadrunner Customer Service Phone Number
Roadrunner Customer Service Number
Roadrunner Customer Support Phone Number
Roadrunner Customer Support Number
Roadrunner Helpline
Roadrunner Help
Roadrunner Phone Number
Roadrunner Contact Number



14
De: Mumbai Escorts Fecha: 2019-03-30 09:39

Mumbai Escorts
Goa Escorts
Mumbai Escorts
coimbatore escorts
rajkot escorts services
goa escorts services
mire road escorts
andheri escorts
andheri escorts services
roku remote not working
mcafee.com/activate
escorts web development company
web development company in india
download McAfee Antivirus
Download free php projects
activate ESPN on Roku



15
De: wertyuiop Fecha: 2019-03-30 13:07

Epson Printer Support
Epson Printer Customer Service
Epson Printer Phone Number
Epson Printer Contact Number
Epson Printer Technical Support



16
De: windowfashionsdepot Fecha: 2019-05-26 19:26

Blinds, Shades, Shutters, Window Covering - windowfashionsdepot.com



17
De: windowfashionsdepot Fecha: 2019-05-26 19:26

Blinds, Shades, Shutters, Window Covering - windowfashionsdepot.com



18
De: igorstravinsk6 Fecha: 2019-05-29 06:53

I plan to reread your article later to think on your unique ideas. Your article is very persuasive. It’s already in my favorite’s folder so I can quickly access it. free fire jogar



19
De: lechateauguillestre.com Fecha: 2019-06-11 20:02

lyly



20
De: aol support Fecha: 2019-06-19 14:14

Activate avast antivirus
at&t support
canon printer support
dell printer support
web development company
garmin update
gmail support
hotmail support
reset aol password
install roku
microsoft helpline number
norton.com/setup
office.com/setup
quickbooks error 3371
quickbooks support
quickbooks tech support number
quickbooks error 3100
quickbooks error 2000
roadrunner support
roku.com/link
yahoo customer service number
activate nbc
problems reading or receiving aol mail/
fix problems signing in to aol mail
quickbooks error h202
reset yahoo password
repair quickbooks damaged company file
import bank statements in csv format in quickbooks
roku remote not working
mcafee.com/activate
activate espn on roku
mumbai escorts
mumbai escorts
mumbai call girls
Mumbai Escorts
Mumbai Escorts
best web hosting provider
reset Garmin GPS
Reset Outlook Password
escorts web development company
how to create facebook ads
yahoo reset password
What is Social CRM
hp driver support
How to scan from HP printer
hp printer support
aol.com login
aol com mail
norton firfox extension
quickbooks small business accounting software
norton security download
epson printer support
yahoo support
Install ms office for macbook pro
Install ms office on mac
quickbooks support
mcafee.com/activate
roku tv frozen
roku.com/link
guest post
Norton Password Generator
norton support
netgear support
netgear router setup
web designing company
seo company
garmin update
garmin updates
garmin express update
norton.com/setup
office.com/setup
Google Chrome Not working
quickbooks support
quickbooks tech support
outlook support
Add Users in QuickBooks
roku remote not working
gmail support
quickbooks tech support number
andheri escorts
computer repair
computer repair
computer repair near me
netflix not working
garmin update
outlook password reset
reset microsoft password
reset microsoft account password
quickbooks pro support
Cyber Security Skills
xero support
aol support
facebook support
verizon support
Mumbai escorts
at&t password reset
roku update
hp support
mumbai escorts
andheri escorts
bandra escorts
andheri escorts
roku.com/link



21
De: youssou Fecha: 2019-06-19 23:01

montre homme Hugo boss



22
De: Montre femme Hamilton Fecha: 2019-06-25 22:18

lyly



23
De: Rustam Alam Fecha: 2019-07-04 18:17

  • ULTRATECH4YOU

  • Parvez Alam Ansari

  • ULTRATECH4YOU

  • Parvez Alam Ansari




  • 24
    De: Montre ice-watch Fecha: 2019-07-09 23:39

    lyly



    25
    De: aol support Fecha: 2019-07-19 13:07

    aol reset password
    cox support
    xbox support
    xfinity support
    yahoo support
    hp printer support
    gmail support
    hp printer support
    activate espn on roku
    activate starz on roku
    aol support
    at&t support
    hulu.com/activate
    roadrunner support
    roku.com/link
    Norton Support
    hotmail support
    Linksys Router Support
    Dlink Router Support
    Chembur Escorts
    malad Escorts
    colaba Escorts
    juhu Escorts
    thane escorts
    mira road escorts
    bandra escorts
    vashi escorts
    roku.com/link
    canon.com/ijsetup
    gmail password reset
    mumbai escorts
    aol support



    26
    De: PERSONALISED WATER BOTTLES IN THE UK Fecha: 2019-08-05 15:53

    Eco-Friendly Bamboo Water Bottles



    27
    De: games for in school Fecha: 2019-08-11 14:00

    games for in school



    28
    De: Sophie Fecha: 2019-08-18 06:45

    Thanks for posting this info. I just want to let you know that I just check out your site and I find it very interesting and informative. I can't wait to read lots of your posts. Visit this post to earn PayPal Money



    29
    De: ceramic car coating Fecha: 2019-08-20 08:47

    When the vehicle has been altogether washed and cleaned, it is the ideal opportunity for the intensifying procedure to start. What this implies the applier will clean the vehicle or a piece of it with a cutting compound.



    Nombre
    Correo-e
    URL
    Dirección IP: 3.81.28.94 (d9c6254a32)
    Comentario
    ¿Cuánto es: diez mil + uno?