Re: [R] Help

2024-02-20 Thread Jeff Newmiller via R-help
Regarding 1 and 2, please read the Posting Guide mentioned at the bottom of 
every R-help post. R does not equal statistics... and education about 
statistics is way too ambitious to include in this mailing list that is about a 
tool that happens to be useful for statisticians.

There are forums online that do cater to statistical methods (e.g. Cross 
Validated or many results from a search engine)... but such conversations can 
be extensive so as Rolf suggests this is a good time to learn what resources 
your educational institutions can provide... online forums may be too limiting 
when your questions are so vague.

On February 20, 2024 2:14:58 PM PST, Rolf Turner  wrote:
>
>On Mon, 19 Feb 2024 17:39:23 +0100
>Lisa Hupfer via R-help  wrote:
>
>> I am writing my master thesis in which I compared two cultures . So
>> for my statistics I need to compare Age,Sex,Culture as well as have a
>> look at the tasks scores .
>> 
>> Anyone familiar with this ?
>> I’d love to share my script so you guide me where I did wrong .
>
>(1) This post is far too vague to be appropriate for this list.
>
>(2) You should learn some statistics; probably linear modelling.
>
>(3) You should talk to your thesis advisor.
>
>(4) Please see fortunes::fortune(285).
>
>cheers,
>
>Rolf Turner
>
>

-- 
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.


Re: [R] Help

2024-02-20 Thread Rolf Turner


On Mon, 19 Feb 2024 17:39:23 +0100
Lisa Hupfer via R-help  wrote:

> I am writing my master thesis in which I compared two cultures . So
> for my statistics I need to compare Age,Sex,Culture as well as have a
> look at the tasks scores .
> 
> Anyone familiar with this ?
> I’d love to share my script so you guide me where I did wrong .

(1) This post is far too vague to be appropriate for this list.

(2) You should learn some statistics; probably linear modelling.

(3) You should talk to your thesis advisor.

(4) Please see fortunes::fortune(285).

cheers,

Rolf Turner


-- 
Honorary Research Fellow
Department of Statistics
University of Auckland
Stats. Dep't. (secretaries) phone:
 +64-9-373-7599 ext. 89622
Home phone: +64-9-480-4619

__
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] Network issue

2024-02-20 Thread Jeff Newmiller via R-help
... and if the problem is networking, then you will likely need help from 
someone who knows your local configuration. Employers often do things that 
limit what R can do, and none of us are likely to know about those things.

On February 20, 2024 11:43:24 AM PST, stephen sefick  wrote:
>Maybe I missed the rest of the post? You are more likely to get help with
>your problems if you create a minimal reproducible example.
>Kindest regards,
>
>Stephen Sefick
>
>On Tue, Feb 20, 2024, 12:24 James Powell  wrote:
>
>>
>
>   [[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.

-- 
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.


Re: [R] Network issue

2024-02-20 Thread stephen sefick
Maybe I missed the rest of the post? You are more likely to get help with
your problems if you create a minimal reproducible example.
Kindest regards,

Stephen Sefick

On Tue, Feb 20, 2024, 12:24 James Powell  wrote:

>

[[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] Including an external set of coded

2024-02-20 Thread CALUM POLWART
What happens if you add a line to the code in lines 1-5.  So line 5 is now
line 6 etc?

Your "procedure" needs a name

So either it's a function, OR, we each procedure is a file to source?

On Tue, 20 Feb 2024, 16:55 Steven Yen,  wrote:

> I see——still put those lines in a procedure and call the procedure by
> “source”. I source procedures all the time.
>
> I just wondered whether there is a way to “source” these lines without
> putting them in a procedure. Because I have too many of such lines which I
> use in several main programs annd only reason I want to do this is to keep
> my main programs compact.
>
> Steven from iPhone
>
> On Feb 21, 2024, at 12:44 AM, CALUM POLWART  wrote:
>
> 
> Are you asking to source lines 5-10 of a file for instance?
>
> Never seen that done in R. Feels a dodgy thing to do as changing line will
> screw things up.  On the other hand - I'd often have functions in a file
> called perhaps "functions.R" and source("functions.R")
>
> Then I can call an individual function something like
>
> tranform_mydata(mydata)
>
>
>
> With the functions.R containing
>
> transform_mydata <- function (mydata) {
>
> mydata<-transform(mydata,
> a<-b+c
> d<-e+f
>
> return(mydata)
> }
>
> On Tue, 20 Feb 2024, 15:46 Bert Gunter,  wrote:
>
>> I believe you will have to expain what you want more fully, as what you
>> requested appears to be exactly what source() does, to me anyway. Please
>> reread its help file more carefully perhaps?
>>
>> -- Bert
>>
>> On Tue, Feb 20, 2024 at 7:36 AM Steven Yen  wrote:
>>
>> > How can I call and include an external set of R codes, not necessarily a
>> > complete procedure (which can be include with a “source” command).
>> Example:
>> >
>> > #I like to include and run the following lines residing in a file
>> outside
>> > the main program:
>> >
>> > mydata<-transform(mydata,
>> > a<-b+c
>> > d<-e+f
>> > }
>> >
>> >
>> > Steven from iPhone
>> > [[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.
>>
>

[[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

2024-02-20 Thread Lisa Hupfer via R-help
I am writing my master thesis in which I compared two cultures . So for my 
statistics I need to compare Age,Sex,Culture as well as have a look at the 
tasks scores .

Anyone familiar with this ?
I’d love to share my script so you guide me where I did wrong . 

Regards 

__
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] Network issue

2024-02-20 Thread James Powell

R version 4.3.1 (2023-06-16 ucrt) -- "Beagle Scouts"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> utils:::menuInstallPkgs()
--- Please select a CRAN mirror for use in this session ---
Warning: failed to download mirrors file (cannot open URL 
'https://cran.r-project.org/CRAN_mirrors.csv'); using local file 
'C:/PROGRA~1/R/R-43~1.1/doc/CRAN_mirrors.csv'
Error in contrib.url(repos, type) : 
  trying to use CRAN without setting a mirror
In addition: Warning message:
In download.file(url, destfile = f, quiet = TRUE) :
  URL 'https://cran.r-project.org/CRAN_mirrors.csv': status was 'SSL connect 
error'
> utils:::menuInstallLocal()
Warning in file(name, "wb") :
  cannot open file 'openssl/tests/keys/message.rsa.crypt': Permission denied
Error in file(name, "wb") : cannot open the connection
Warning message:
In install.packages(files[tarballs], .libPaths()[1L], repos = NULL,  :
  installation of package ‘C:/Users/jpowell/DOWNLO~1/openssl_2.1.1 (1).tar.gz’ 
had non-zero exit status
> utils:::menuInstallLocal()
* installing *source* package 's2' ...
** package 's2' successfully unpacked and MD5 sums checked
** using staged installation
** libs
using C compiler: 'gcc.exe (GCC) 12.2.0'
using C++ compiler: 'G__~1.EXE (GCC) 12.2.0'
using C++11
g++  -std=gnu++11 -I"C:/PROGRA~1/R/R-43~1.1/include" -DNDEBUG 
-DS2_USE_EXACTFLOAT -D_USE_MATH_DEFINES -DNDEBUG -DIS_LITTLE_ENDIAN 
-DOMIT_STRPTIME -I../windows/openssl-1.1.1k/include -I../src 
-I'C:/Users/jpowell/AppData/Local/R/win-library/4.3/Rcpp/include' 
-I'C:/Users/jpowell/AppData/Local/R/win-library/4.3/wk/include'   
-I"C:/rtools43/x86_64-w64-mingw32.static.posix/include" -O2 -Wall  
-mfpmath=sse -msse2 -mstackrealign  -c RcppExports.cpp -o RcppExports.o
g++  -std=gnu++11 -I"C:/PROGRA~1/R/R-43~1.1/include" -DNDEBUG 
-DS2_USE_EXACTFLOAT -D_USE_MATH_DEFINES -DNDEBUG -DIS_LITTLE_ENDIAN 
-DOMIT_STRPTIME -I../windows/openssl-1.1.1k/include -I../src 
-I'C:/Users/jpowell/AppData/Local/R/win-library/4.3/Rcpp/include' 
-I'C:/Users/jpowell/AppData/Local/R/win-library/4.3/wk/include'   
-I"C:/rtools43/x86_64-w64-mingw32.static.posix/include" -O2 -Wall  
-mfpmath=sse -msse2 -mstackrealign  -c cpp-compat.cpp -o cpp-compat.o
g++  -std=gnu++11 -I"C:/PROGRA~1/R/R-43~1.1/include" -DNDEBUG 
-DS2_USE_EXACTFLOAT -D_USE_MATH_DEFINES -DNDEBUG -DIS_LITTLE_ENDIAN 
-DOMIT_STRPTIME -I../windows/openssl-1.1.1k/include -I../src 
-I'C:/Users/jpowell/AppData/Local/R/win-library/4.3/Rcpp/include' 
-I'C:/Users/jpowell/AppData/Local/R/win-library/4.3/wk/include'   
-I"C:/rtools43/x86_64-w64-mingw32.static.posix/include" -O2 -Wall  
-mfpmath=sse -msse2 -mstackrealign  -c init.cpp -o init.o
g+
In file included from ../src/s2/s2cap.h:26,
 from ../src/s2/s2convex_hull_query.h:25,
 from s2geography/accessors-geog.h:4,
 from s2geography.h:4,
 from geography.h:7,
 from geography-operator.h:7,
 from s2-accessors.cpp:2:
../src/s2/encoded_uint_vector.h: In function 'void 
s2coding::EncodeUintWithLength(T, int, Encoder*)':
../src/s2/base/logging.h:169:47: warning: comparison of integer expressions of 
different signedness: 'size_t' {aka 'long long unsigned int'} and 'int' 
[-Wsign-compare]
  169 | #define S2_DCHECK_GE(val1, val2) S2_DCHECK_OP(>=, val1, val2)
  |   ^
../src/s2/base/logging.h:151:22: note: in definition of macro 'S2_DCHECK'
  151 | while (false && (condition)) S2NullStream()
  |  ^
../src/s2/base/logging.h:169:34: note: in expansion of macro 'S2_DCHECK_OP'
  169 | #define S2_DCHECK_GE(val1, val2) S2_DCHECK_OP(>=, val1, val2)
  |  ^~~~
../src/s2/encoded_uint_vector.h:134:3: note: in expansion of macro 
'S2_DCHECK_GE'
  134 |   S2_DCHECK_GE(encoder->avail(), length);
  |   ^~~~
../src/s2/encoded_uint_vector.h: In instantiation of 'T 
s2coding::EncodedUintVector::operator[](int) const [with T = long long 
unsigned int]':
../src/s2/encoded_string_vector.h:146:47:   required from here
../src/s2/encoded_uint_vector.h:246:25: warning: comparison of integer 
expressions of different signedness: 'int' and 'const uint32' {aka 'const 
unsigned int'} [-Wsign-compare]
  246 |   S2_DCHECK(i >= 0 && i < size_);
  |   ~~^~~

Re: [R] Including an external set of coded

2024-02-20 Thread CALUM POLWART
Are you asking to source lines 5-10 of a file for instance?

Never seen that done in R. Feels a dodgy thing to do as changing line will
screw things up.  On the other hand - I'd often have functions in a file
called perhaps "functions.R" and source("functions.R")

Then I can call an individual function something like

tranform_mydata(mydata)



With the functions.R containing

transform_mydata <- function (mydata) {

mydata<-transform(mydata,
a<-b+c
d<-e+f

return(mydata)
}

On Tue, 20 Feb 2024, 15:46 Bert Gunter,  wrote:

> I believe you will have to expain what you want more fully, as what you
> requested appears to be exactly what source() does, to me anyway. Please
> reread its help file more carefully perhaps?
>
> -- Bert
>
> On Tue, Feb 20, 2024 at 7:36 AM Steven Yen  wrote:
>
> > How can I call and include an external set of R codes, not necessarily a
> > complete procedure (which can be include with a “source” command).
> Example:
> >
> > #I like to include and run the following lines residing in a file outside
> > the main program:
> >
> > mydata<-transform(mydata,
> > a<-b+c
> > d<-e+f
> > }
> >
> >
> > Steven from iPhone
> > [[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.
>

[[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] Including an external set of coded

2024-02-20 Thread Bert Gunter
I believe you will have to expain what you want more fully, as what you
requested appears to be exactly what source() does, to me anyway. Please
reread its help file more carefully perhaps?

-- Bert

On Tue, Feb 20, 2024 at 7:36 AM Steven Yen  wrote:

> How can I call and include an external set of R codes, not necessarily a
> complete procedure (which can be include with a “source” command). Example:
>
> #I like to include and run the following lines residing in a file outside
> the main program:
>
> mydata<-transform(mydata,
> a<-b+c
> d<-e+f
> }
>
>
> Steven from iPhone
> [[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.


[R] Including an external set of coded

2024-02-20 Thread Steven Yen
How can I call and include an external set of R codes, not necessarily a 
complete procedure (which can be include with a “source” command). Example:

#I like to include and run the following lines residing in a file outside the 
main program:

mydata<-transform(mydata,
a<-b+c
d<-e+f
}


Steven from iPhone
[[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] Looping

2024-02-20 Thread Steven Yen


Steven from iPhone

> On Feb 19, 2024, at 4:56 PM, Steven Yen  wrote:
> 
> Thanks to all. Glad there are many options.
> 
> Steven from iPhone
> 
>>> On Feb 19, 2024, at 1:55 PM, Rui Barradas  wrote:
>>> 
>> Às 03:27 de 19/02/2024, Steven Yen escreveu:
>>> I need to read csv files repeatedly, named data1.csv, data2.csv,… 
>>> data24.csv, 24 altogether. That is,
>>> data<-read.csv(“data1.csv”)
>>> …
>>> data<-read.csv(“data24.csv”)
>>> …
>>> Is there a way to do this in a loop? Thank you.
>>> Steven from iPhone
>>>[[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.
>> Hello,
>> 
>> Here is a way of reading the files in a *apply loop. The file names are 
>> created by getting them from file (list.files) or by a string editing 
>> function (sprintf).
>> 
>> 
>> # file_names_vec <- list.files(pattern = "data\\d+\\.csv")
>> file_names_vec <- sprintf("data%d.csv", 1:24)
>> data_list <- sapply(file_names_vec, read.csv, simplify = FALSE)
>> 
>> # access the 1st data.frame
>> data_list[[1L]]
>> # same as above
>> data_list[["data1.csv"]]
>> # same as above
>> data_list$data1.csv
>> 
>> 
>> Hope this helps,
>> 
>> Rui Barradas
>> 
>> 
>> 
>> --
>> Este e-mail foi analisado pelo software antivírus AVG para verificar a 
>> presença de vírus.
>> www.avg.com

[[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.