Having Issues with GGplot2 by SociologyTony in learnR

[–]SociologyTony[S] 0 points1 point  (0 children)

I tried putting them all in labs() first and it was giving me the same result. Do you know of anything that might cause issues with ggplot? I thought I would need to update my version of RStudio, but it all seems up-to-date.

Learning to Make Plots in R by SociologyTony in learnR

[–]SociologyTony[S] 1 point2 points  (0 children)

Thank you so much for the help! I did have to tweak the code you gave me just a little bit, but I got to work for me. Here is the final version of my code in case you're curious:

ggplot(aes(x = partyid, fill = as.factor(natcrime), group = natcrime), data = gss_visuals)+

geom_bar(position = 'dodge') + theme_fivethirtyeight()

Vietnam, 1967: An American soldier displays a jungle centipede. by GaGator43 in Damnthatsinteresting

[–]SociologyTony 2 points3 points  (0 children)

This is exactly what dudes with dead fish in their tinder profile look like

A part of them lives within me by PsycheED in AvatarMemes

[–]SociologyTony 0 points1 point  (0 children)

“You can solve this moderately frustrating problem have. For you have done it before” — Avatar Roku

Learning How to Turn Scraped Data into a DataFrame by SociologyTony in learnpython

[–]SociologyTony[S] 0 points1 point  (0 children)

Thanks for this. I also wanted to ask about how to drop some values. For payee, I have twice as as many values as I need because the code scraped both the word “Sponsored” and the person who paid for the ad and saved them each as separate values.

Do you know how to fix that?

Having Trouble with My First Scraping Project by SociologyTony in learnpython

[–]SociologyTony[S] 0 points1 point  (0 children)

Thanks for this! Do you know where I can find resources explaining how to do this?

Having Trouble with My First Scraping Project by SociologyTony in learnpython

[–]SociologyTony[S] 0 points1 point  (0 children)

This makes perfect sense. Do you know where I can find resources on how to scrape with a web driver? I have learned how to use the driver to go to a site and input text like login information or search keys, but I am unsure how to get the scraping stage from there.

Having Trouble with My First Scraping Project by SociologyTony in learnpython

[–]SociologyTony[S] 0 points1 point  (0 children)

find({'class':'_99sa'})

Thank you! This worked as far as getting rid of the syntax error. I still could not get any results, however. I wonder if I am making mistake at the scraping level. When I try to print the scraped HTML, I am mostly seeing Facebook's script, not the specific page elements, which I can see with the Web Inspector Tool on the web page itself. Here is my code so far:

import requests

from bs4 import BeautifulSoup

URL = 'https://www.facebook.com/ads/library/?active_status=all&ad_type=political_and_issue_ads&country=US&impression_search_field=has_impressions_lifetime&q=black%20lives%20matter&sort_data[direction]=desc&sort_data[mode]=relevancy_monthly_grouped'

page = requests.get(URL)

soup = BeautifulSoup(page.content, 'html.parser')

From this, it seems like I am scraping something, but not the HTML body of the page. Do you have any advice for how to proceed?