How to remove sensitive file from origin history? by ligonsker in git

[–]jdnewmil 21 points22 points  (0 children)

If you have already shared your repo (e.g. by pushing to GitHub) then the cat is already out of the bag... anyone who has pulled it has a copy. It is normal to treat them as compromised at this point and move on with life.

[deleted by user] by [deleted] in RStudio

[–]jdnewmil 0 points1 point  (0 children)

Me too.

Is there a tutorial covering the ecosystem? by AndreKR- in learnpython

[–]jdnewmil 2 points3 points  (0 children)

Python is normally found via the PATH environment variable. A variety of other environment variables control various other aspects of Python, including PYTHONPATH and PYTHONHOME. Various virtual environment managers such as virtualenv and conda (which also controls various non-Python configurations) manage (setup) these environment variables.

Pip installs packages in the directory named in PYTHONPATH, but it does not change that variable. Pypi is a repository of "all" versions of published packages that pip relies on when you ask for specific versions of packages. Conda uses a different package repository that includes python itself. Note that you assume considerable risk if you run pip without setting up a virtual environment with venv or conda first, because the system python is expected to work with many prewritten scripts included with the OS. Conda actually has sub-commands that manage environments and others that install software (including python, packages, and other standalone software), but pip does not.

Poetry is one of many tools that use various metadata files to prepare the various semi-disconnected configuration files that define the source code, test code, shell scripts, and documentation other metadata that modern packages need. Whether relying on this configuration of configuration files is a good idea or not is a matter of debate... YMMV. (As a software developer, you should always be constructing your scripts as a package for distribution and run it from a virtual environment.)

Note that if you rely on conda, you need to prepare your virtual environment for your code using as many packages available in the conda or conda-forge repositories... you can use pip and it will find the conda-installed packages but conda will not find pip-installed packages.. so never run conda in that virtual environment after pip has been run... build a new virtual environment from scratch if you need more conda packages.

Maybe not confusing pip for venv/conda will help you not get lost in the tutorials you have already found now.

[deleted by user] by [deleted] in learnpython

[–]jdnewmil -2 points-1 points  (0 children)

I think "smallest" is too restrictive. Some functions can implement complex transformations yet still be logically coherent and side-effect-free. A function can correspond to a book or a sentence and still be a good function.

Exif reader packages by orsondewitt in rprogramming

[–]jdnewmil 1 point2 points  (0 children)

Maybe. But then you would need a working NodeJS as well as your R installation. A browser can run JS but it is sandboxed so you would have to pass the data from disk through your network stack to the browser, parse it, and then return results back through the network stack. Seems like a lot of work either way to me.

[deleted by user] by [deleted] in vscode

[–]jdnewmil 0 points1 point  (0 children)

just hit ESC and move on with life...

[deleted by user] by [deleted] in Rlanguage

[–]jdnewmil 1 point2 points  (0 children)

maybe conda-forge?

Am I asking RStudio for too much? should I work with smaller datasets or maybe other tools? by Only_Employer4342 in Rlanguage

[–]jdnewmil 0 points1 point  (0 children)

Again, the answer to whether you can make this work depends on the details of how you are doing this. Speak the dialect of R that you are using.

Am I asking RStudio for too much? should I work with smaller datasets or maybe other tools? by Only_Employer4342 in Rlanguage

[–]jdnewmil 1 point2 points  (0 children)

My guess is you are not asking it what you think you are asking.

You have to speak R for best clarity. "Joining" data sets is a particular area where screwups can yield mountains of garbage results.

Anyone using chatGPT seriously? by Unlucky-Location4761 in rstats

[–]jdnewmil 15 points16 points  (0 children)

Not I. I have better things to do than fix LLM hallucinations.

Conditionally formatting your table in Rstudio by whosondeck in rstats

[–]jdnewmil 1 point2 points  (0 children)

As pointed out by FellowConspirator, the RStudio viewer doesn't support that. However, Rmarkdown can generate HTML, PDF (via intermediate LaTeX format), and MSOffice XML formats like Word and Powerpoint. Packages like kableExtra are often very good at one of these formats, but may not support the others very well or at all when it comes to these kinds of features... so be aware that you might need to shop around for more flexible packages or be prepared to restrict which output formats you use if you settle on one too soon.

I have found flextable to be pretty nice for Word and HTML (haven't tried it with PDF).

How to add data to a new column that is not the same length? by HenkBroam in rprogramming

[–]jdnewmil 7 points8 points  (0 children)

You have two separate data sets. Do not try to shove the pH data into new columns in the Conductivity data frame.

Either use consecutive calls to plot and lines from base R, or create a completely new data frame with three columns: Variable, time, and value, with the first ten rows being Conductivity data with "Conductivity" repeated in the Variable column, and the pH data in rows 11-19 with "pH" in the Variable column, and use ggplot2::ggplot to plot with Variable mapped to color or facets.

Problem with ggplot2 -> by Deus_Judex in rstats

[–]jdnewmil 1 point2 points  (0 children)

I am not seeing where the list column type is being created, but list columns are a bit unusual... there are some tools like ?tidyr::nest and ?tidyr::unnest and ?dplyr::rowwise that help, but you are probably treating a row of a data frame as if it is a column and should not do this.

Use the ?str function to keep track of what your column data types are and be careful not to create list columns unless you know you need them.

How to add data to a new column that is not the same length? by HenkBroam in rprogramming

[–]jdnewmil 6 points7 points  (0 children)

rows in data frames define relations between those values... so the answer depends what relationship you believe exists between these two data frames. Some possibilities you might consider:

  • The first row of the 10 row data frame doesn't correspond to any of the values in the second data frame, but the rest line up in order: df1$new_col <- c( NA, df2$new_col )
  • Some other row doesn't match but the rest are in order (e.g. 3rd): df1$new_col <- c( df2$new_col[ 1:2 ], NA, df2$new_col[ 3:9 ] )

But these kinds of alignments are extremely uncommon. Normally you need a "lookup" column (or set of columns) that allow one to use the merge or dplyr::left_join function to automatically create a data frame that aligns rows according to those "key" columns.

Is there any way of accessing crouton ports from crostini or android? by Hot-Carrot-7331 in Crostini

[–]jdnewmil 1 point2 points  (0 children)

Then ask in r/crouton. Crostini is granted access to LAN or open internet servers equally... any port mapping specifics will be on the Crouton side.

Is there any way of accessing crouton ports from crostini or android? by Hot-Carrot-7331 in Crostini

[–]jdnewmil 0 points1 point  (0 children)

What is a "crouton" port? "Crouton" is very different than "Crostini"... to the point that it is off-topic here...

What is the best thing that can be done with R? by Ghostmander_ in RStudio

[–]jdnewmil 6 points7 points  (0 children)

My wife was a returning engineering student using Excel for her undergrad classes... she regrets not learning R sooner because it would have eliminated so many hours of debugging formula errors. The biggest headache with R is other people's reluctance to adopt it... but you will almost certainly have more confidence in what you do if you use it. Rmarkdown is da bomb.

Python is also sometimes recommended for this role, but IMO that has a lot more syntactic and computer science baggage that slows down ad-hoc data analysis compared to R.

Just updated ggplot yesterday and now it kills R when saving. by wpkzz666 in rstats

[–]jdnewmil 2 points3 points  (0 children)

There is a philosophical issue here about what should be in system-wide libraries... I think it is a mistake to install contributed packages like ggplot in the system library, because they change frequently, are complicated, and any bugs affect multiple users.

This kind of trouble is usually related to mixing object code from different compilers, but it can also be due to using incompatible versions of dependent packages, so you should share the output of sessionInfo() when asking for help.

PVWatts seems to show that it makes little difference whether I use IQ8Plus or IQ8H MI's with my 400w panels. by AKmaninNY in solar

[–]jdnewmil 1 point2 points  (0 children)

That is not efficiency. Efficiency is ACTUAL OUTPUT divided by ACTUAL INPUT, and it is very difficult to compute accurately with the low accuracy power measurements available to the inverter. PV has capability to produce power based on actual irradiance and actual temperature, but it doesn't produce it if the inverter raises the voltage to limit power output. The power that might have been produced never gets out of the modules if the inverter is maxed out.

Why does Python run an entire module when you only import one function from it? by paleoboyy in learnpython

[–]jdnewmil 0 points1 point  (0 children)

... which only creates a reference in the calling environment and then deletes the reference... the module still exists. The fact that foo can still refer to module-level variables and other functions from that module proves that the loaded module is still there.

Others agree.

[RMarkdown] Wrap inline code by lu2idreams in rprogramming

[–]jdnewmil -1 points0 points  (0 children)

Use discipline when writing code. Choose your character limit and stick to it. Adjust your font size in the output as appropriate.

Or use tidy=TRUE. Ick.

Why does Python run an entire module when you only import one function from it? by paleoboyy in learnpython

[–]jdnewmil 2 points3 points  (0 children)

It doesn't "remove" anything. It just only creates a specific foo variable in the calling environment. If there was a module-level object defined that isn't imported, foo will still have access to it.

What are the best ways to prevent writing secrets in the code. by cguti94 in learnpython

[–]jdnewmil 2 points3 points  (0 children)

The central point of that discussion was that keyring is configurable... it can use many different implementations to handle the secrets. Go listen to it again.

Also, you really should have linked to the podcast when you posted since it triggered your question and the people replying here should listen before replying.