Re: [R] Error 3221226505

2022-12-18 Thread Bill Dunlap
Note that 3221226505 in base 10 is C409 in hexadecimal.  You may have
better luck looking for causes of this by googling the hex representation.

-Bill

On Sun, Dec 18, 2022 at 3:56 PM Mathurin, Gottfried via R-help <
r-help@r-project.org> wrote:

> Hello,
> I currently face the issue of Windows 10 throwing a code 3221226505
> whenever I try to use R-4.1.3.
> Is this issue known and could you possibly share a fix?
>
> Thank you in advance,
>
> *Gottfried*
>
> --
>
>
> This
>
> e-mail transmission (message and any attached files) may contain
> information that is proprietary, privileged and/or confidential to Veolia
> Environnement and/or its affiliates and is intended exclusively for the
> person(s) to whom it is addressed. If you are not the intended recipient,
> please notify the sender by return e-mail and delete all copies of this
> e-mail, including all attachments. Unless expressly authorized, any use,
> disclosure, publication, retransmission or dissemination of this e-mail
> and/or of its attachments is strictly prohibited.
>
>
> Ce message
> electronique et ses fichiers attaches sont strictement confidentiels et
> peuvent contenir des elements dont Veolia Environnement et/ou l'une de ses
> entites affiliees sont proprietaires. Ils sont donc destines a l'usage de
> leurs seuls destinataires. Si vous avez recu ce message par erreur, merci
> de le retourner a son emetteur et de le detruire ainsi que toutes les
> pieces attachees. L'utilisation, la divulgation, la publication, la
> distribution, ou la reproduction non expressement autorisees de ce message
> et de ses pieces attachees sont interdites.
>
> 
>
> [[alternative HTML version deleted]]
>
> __
> R-help@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@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.


Re: [R] Error 3221226505

2022-12-18 Thread David Winsemius
I cannot tell whether it would happen to me for two reasons: I don't use 
Windows anymore and R's current version is 4.2.1.



You can determine whether it is the core packages that are throwing the 
error (rather unlikely) or perhaps something you have in your 
(invisible) .Rdata file. You should probably update your installation of 
R and throw away the .Rdata file that I suspect has gotten corrupted or 
is loading a flaky package. If you don't want to update R, then you 
should at the very least try to run R from a command line with



>  R --vanilla

At least that's I what I remember from my Windows daze. You should also 
review the Win-R-FAQ which I think has similar advice.



--

David

On 12/18/22 16:20, Jeff Newmiller wrote:

Doesn't happen to me.

On December 16, 2022 12:44:17 AM PST, "Mathurin, Gottfried via R-help" 
 wrote:

Hello,
I currently face the issue of Windows 10 throwing a code 3221226505
whenever I try to use R-4.1.3.
Is this issue known and could you possibly share a fix?

Thank you in advance,

*Gottfried*



__
R-help@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.


Re: [R] Error 3221226505

2022-12-18 Thread Jeff Newmiller
Doesn't happen to me.

On December 16, 2022 12:44:17 AM PST, "Mathurin, Gottfried via R-help" 
 wrote:
>Hello,
>I currently face the issue of Windows 10 throwing a code 3221226505
>whenever I try to use R-4.1.3.
>Is this issue known and could you possibly share a fix?
>
>Thank you in advance,
>
>*Gottfried*
>

-- 
Sent from my phone. Please excuse my brevity.

__
R-help@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.


[R] Error 3221226505

2022-12-18 Thread Mathurin, Gottfried via R-help
Hello,
I currently face the issue of Windows 10 throwing a code 3221226505
whenever I try to use R-4.1.3.
Is this issue known and could you possibly share a fix?

Thank you in advance,

*Gottfried*

-- 


This
 
e-mail transmission (message and any attached files) may contain 
information that is proprietary, privileged and/or confidential to Veolia 
Environnement and/or its affiliates and is intended exclusively for the 
person(s) to whom it is addressed. If you are not the intended recipient, 
please notify the sender by return e-mail and delete all copies of this 
e-mail, including all attachments. Unless expressly authorized, any use, 
disclosure, publication, retransmission or dissemination of this e-mail 
and/or of its attachments is strictly prohibited. 


Ce message 
electronique et ses fichiers attaches sont strictement confidentiels et 
peuvent contenir des elements dont Veolia Environnement et/ou l'une de ses
entites affiliees sont proprietaires. Ils sont donc destines a l'usage de 
leurs seuls destinataires. Si vous avez recu ce message par erreur, merci 
de le retourner a son emetteur et de le detruire ainsi que toutes les 
pieces attachees. L'utilisation, la divulgation, la publication, la 
distribution, ou la reproduction non expressement autorisees de ce message
et de ses pieces attachees sont interdites.


[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Amazing AI

2022-12-18 Thread Ebert,Timothy Aaron
It would help students formulate a plan for coding. Successful students will be 
able to give good directions that the AI can turn into good code. This skill is 
essential no matter who writes the program. 
In more advanced classes I might collect some data sets designed to cause the 
AI problems. Another option is to make tests where students have to write code 
on paper or multiple guess where students must choose between similar code 
snips.


-Original Message-
From: R-help  On Behalf Of Boris Steipe
Sent: Sunday, December 18, 2022 2:01 PM
To: r-help@r-project.org
Subject: [R] Amazing AI

[External Email]

Technically not a help question. But crucial to be aware of, especially for 
those of us in academia, or otherwise teaching R. I am not aware of a suitable 
alternate forum. If this does not interest you, please simply ignore - I 
already know that this may be somewhat OT.

Thanks.
--

You very likely have heard of ChatGPT, the conversation interface on top of the 
GPT-3 large language model and that it can generate code. I thought it doesn't 
do R - I was wrong. Here is a little experiment:

MY PROMPT:
==
Please write me some R code that will read a tsv file, remove all rows that 
have duplicates in the column "names", and store the median values of the 
remaining rows in a variable called "Medians". Of course, that calculation 
should only be done with columns that are numeric. Print the last variable in 
order from largest to smallest.


AI RESPONSE:


Here is some R code that should accomplish what you've described:

(Note: the code is formatted in a little terminal window, complete with a 
button to "copy code" at the top.)


# Read the tsv file
data <- read.table("file.tsv", header = TRUE, sep = "\t")

# Remove rows with duplicates in the "names" column data <- 
data[!duplicated(data$names), ]

# Select only the numeric columns
num_columns <- sapply(data, is.numeric)
numeric_data <- data[, num_columns]

# Calculate the medians for each column
Medians <- apply(numeric_data, 1, median)

# Sort Medians in descending order
Medians <- sort(Medians, decreasing = TRUE)

# Print Medians
print(Medians)


This code assumes that the tsv file is called "file.tsv" and is stored in the 
current working directory. It also assumes that the first row of the file 
contains the column names.



MY PROMPT:
==
Can you provide me with a bit of sample data that I can use to test this code?

AI RESPONSE:

Certainly! Here is some sample data that you can use to test the code I 
provided:


nameage height  weight
Alice   23  5.6 120
Bob 32  6.2 180
Charlie 29  5.9 160
Alice   23  5.6 120
David   25  5.8 140
Eve 27  5.5 110


You can save this data as a tsv file and use it to test the code.


--

Notes:
1) The code, as written does not work with the test data. The reason is that 
the test data specifies a column "name", but the code assumes "names" (which I 
specified in the instructions). Once this is fixed in the test data, the code 
executes.

2) The instructions are not accurately translated: I had asked for row means. 
But changing the margin in the apply() statement from 2 to 1 does the correct 
thing.

3) Note that the test data contains both numeric and non-numeric columns. Also, 
the name "Alice" is duplicated in the test data, which is subtle, and the right 
thing to do.


--

A similar experiment, run on the beta-site of OpenAI's Codex code-completion 
tool gives the following code (complete with the comments.):


# Read in the data
data <- read.table("mydata.tsv", sep = "\t", header = TRUE)

# Remove all rows that have duplicates in the column "names"
unique_names <- unique(data$names)
data_unique <- data[data$names %in% unique_names,]

# Calculate medians
Medians <- sapply(data_unique[, sapply(data_unique, is.numeric)], median, na.rm 
= TRUE)

# Print last variable in order form largest to smallest
rev(sort(Medians[length(Medians)]))


Note that the strategy is quite different (e.g using %in%, not duplicated() ), 
the interpretation of "last variable" is technically correct but not what I had 
in mind (ChatGPT got that right though).


Changing my prompts slightly resulted it going for a dplyr solution instead, 
complete with %>% idioms etc ... again, syntactically correct but not giving me 
the fully correct results.

--

Bottom line: The AI's ability to translate natural language instructions into 
code is astounding. Errors the AI makes are subtle and probably not easy to fix 
if you don't already know what you are doing. But the way that this can be 
"confidently incorrect" and plausible makes it nearly impossible to detect 
unless you actually run the code (you may 

[R] Amazing AI

2022-12-18 Thread Boris Steipe
Technically not a help question. But crucial to be aware of, especially for 
those of us in academia, or otherwise teaching R. I am not aware of a suitable 
alternate forum. If this does not interest you, please simply ignore - I 
already know that this may be somewhat OT.

Thanks.
--

You very likely have heard of ChatGPT, the conversation interface on top of the 
GPT-3 large language model and that it can generate code. I thought it doesn't 
do R - I was wrong. Here is a little experiment:

MY PROMPT:
==
Please write me some R code that will read a tsv file, remove all rows that 
have duplicates in the column "names", and store the median values of the 
remaining rows in a variable called "Medians". Of course, that calculation 
should only be done with columns that are numeric. Print the last variable in 
order from largest to smallest.


AI RESPONSE:


Here is some R code that should accomplish what you've described:

(Note: the code is formatted in a little terminal window, complete with a 
button to "copy code" at the top.)


# Read the tsv file
data <- read.table("file.tsv", header = TRUE, sep = "\t")

# Remove rows with duplicates in the "names" column
data <- data[!duplicated(data$names), ]

# Select only the numeric columns
num_columns <- sapply(data, is.numeric)
numeric_data <- data[, num_columns]

# Calculate the medians for each column
Medians <- apply(numeric_data, 1, median)

# Sort Medians in descending order
Medians <- sort(Medians, decreasing = TRUE)

# Print Medians
print(Medians)


This code assumes that the tsv file is called "file.tsv" and is stored in the 
current working directory. It also assumes that the first row of the file 
contains the column names.



MY PROMPT:
==
Can you provide me with a bit of sample data that I can use to test this code?

AI RESPONSE:

Certainly! Here is some sample data that you can use to test the code I 
provided:


nameage height  weight
Alice   23  5.6 120
Bob 32  6.2 180
Charlie 29  5.9 160
Alice   23  5.6 120
David   25  5.8 140
Eve 27  5.5 110


You can save this data as a tsv file and use it to test the code.


--

Notes: 
1) The code, as written does not work with the test data. The reason is that 
the test data specifies a column "name", but the code assumes "names" (which I 
specified in the instructions). Once this is fixed in the test data, the code 
executes.

2) The instructions are not accurately translated: I had asked for row means. 
But changing the margin in the apply() statement from 2 to 1 does the correct 
thing.

3) Note that the test data contains both numeric and non-numeric columns. Also, 
the name "Alice" is duplicated in the test data, which is subtle, and the right 
thing to do.


--

A similar experiment, run on the beta-site of OpenAI's Codex code-completion 
tool gives the following code (complete with the comments.):


# Read in the data
data <- read.table("mydata.tsv", sep = "\t", header = TRUE)

# Remove all rows that have duplicates in the column "names"
unique_names <- unique(data$names)
data_unique <- data[data$names %in% unique_names,]

# Calculate medians 
Medians <- sapply(data_unique[, sapply(data_unique, is.numeric)], median, na.rm 
= TRUE)

# Print last variable in order form largest to smallest
rev(sort(Medians[length(Medians)]))


Note that the strategy is quite different (e.g using %in%, not duplicated() ), 
the interpretation of "last variable" is technically correct but not what I had 
in mind (ChatGPT got that right though).


Changing my prompts slightly resulted it going for a dplyr solution instead, 
complete with %>% idioms etc ... again, syntactically correct but not giving me 
the fully correct results. 

--

Bottom line: The AI's ability to translate natural language instructions into 
code is astounding. Errors the AI makes are subtle and probably not easy to fix 
if you don't already know what you are doing. But the way that this can be 
"confidently incorrect" and plausible makes it nearly impossible to detect 
unless you actually run the code (you may have noticed that when you read the 
code).

Will our students use it? Absolutely.

Will they successfully cheat with it? That depends on the assignment. We 
probably need to _encourage_ them to use it rather than sanction - but require 
them to attribute the AI, document prompts, and identify their own, additional 
contributions.

Will it help them learn? When you are aware of the issues, it may be quite 
useful. It may be especially useful to teach them to specify their code 
carefully and completely, and to ask questions in the right way. Test cases are 
crucial.

How will it affect what we do as instructors? I 

Re: [R] datatable using dt not able to print background colors

2022-12-18 Thread Valentin Petzel
Hello Matt,

I do not think that this is the best place for troubleshooting Chrome issues. 
If your html file shows the colors but print doesn't then the page probably 
uses different stylesheets for display and print. You might want to inspect the 
html for something like this. If you need help, the answers to this should get 
you there:

https://superuser.com/questions/456700/how-do-i-print-with-the-screen-stylesheet

Regards,
Valentin

17.12.2022 01:21:25 Matthew Pirritano :

> Hey, all!
> 
> I've got a report that uses datatable from DT to create an rmarkdown html 
> that looks great as an html but when I try to print it, to a printer, or to a 
> pdf the colors I've assigned to cells are not displaying. I'm using chrome 
> and I've clicked on the Background graphics button there, but that doesn't 
> help print the colors. I have tried to run the datatable section of the code 
> using results = 'asis' and eliminating results = 'asis'. Neither seems to 
> help with the
> 
> My css style at the top of the rmarkdown is
> 
> 
> .main-container {
>   max-width: 1500px;
>   margin-left: auto;
>   margin-right: auto;
>   table.display td { white-space: wrap; }
> 
> }
> td{
>   -webkit-print-color-adjust:exact !important;
>   print-color-adjust:exact !important;
> }
> 
> 
> I added the webkit bit based on what I've found online. Maybe I have 
> something set up incorrectly there? Any ideas or thoughts on how to get this 
> to print the background colors?
> 
> Thanks
> matt
> 
> 
> 
> 
> 
> 
> This communication is intended for the use of the individual or entity to 
> which it is addressed and may contain information that is privileged, 
> confidential or otherwise exempt from disclosure under applicable law. If you 
> are not the intended recipient, you are hereby notified that any 
> dissemination, distribution or copying of this communication is strictly 
> prohibited. If you have received this communication in error, please notify 
> the sender and delete any copies. Thank you.
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@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.

__
R-help@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.