Re: [R] R, RStudio, and a server for my iPad.

2024-05-21 Thread peter dalgaard
...or look inside the administration interface for your router. Typically 
starts with opening a browser on 192.168.0.1 or 192.168.1.1 (with a password 
that you presumably have from your provider) and going to "Access Control" or 
thereabouts.

-pd

> On 12 Apr 2014, at 20:08 , Viechtbauer Wolfgang (STAT) 
>  wrote:
> 
> You will have to enter the external IP address and then use port forwarding.
> 
> Just google for that term (port forwarding) ... For example:
> 
> http://www.howtogeek.com/66214/how-to-forward-ports-on-your-router/
> http://en.wikipedia.org/wiki/Port_forwarding
> 
> Best,
> Wolfgang
> 
> From: r-help-boun...@r-project.org [r-help-boun...@r-project.org] On Behalf 
> Of John Sorkin [jsor...@grecc.umaryland.edu]
> Sent: Saturday, April 12, 2014 7:37 PM
> To: fransiepansiekever...@gmail.com
> Cc: r-help@r-project.org
> Subject: Re: [R] R, RStudio, and a server for my iPad.
> 
> Grand,
> Thank you. I have been able to use my iPad to connect to a server running 
> RStudio server as described in an earlier email and can use the virtual 
> keyboard, which works but is not convenient as one needs to go from keyboard 
> screen to another.
> My current problem is that while I can get everything to work when my iPad is 
> on my local network, I don't know how to access my server from outside my 
> LAN. I know my server's private IP address I know my cable modem's external 
> IP address, but I have no idea what IP address to enter in my iPad, when my 
> iPad is outside my LAN trying to access my server.
> John
> __
> R-help@r-project.org mailing list
> 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.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd@cbs.dk  Priv: pda...@gmail.com

__
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] Listing folders on One Drive

2024-05-21 Thread Jorgen Harmse via R-help
I would just use
fi <- file.info(dir(path, recursive=TRUE, include.dirs=TRUE))
path could be the OneDrive directory or Scotland (and is not needed if you're 
already in the directory you want).
Then rownames(subset(fi, isdir)) will contain all the directories. Maybe you 
want to use grep or other machinery to thin it out.

Regards,
Jorgen Harmse.

--


Message: 1
Date: Mon, 20 May 2024 14:36:58 +0100
From: Nick Wray mailto:nickmw...@gmail.com>>
To: r-help@r-project.org 
Subject: [R] Listing folders on One Drive
Message-ID:
mailto:ds4we...@mail.gmail.com>>
Content-Type: text/plain; charset="utf-8"


Hello I have lots of folders of individual Scottish river catchments on my
uni One Drive. Each folder is labelled with the river name eg "Tay" and
they are all in a folder named "Scotland"
I want to list the folders on One Drive so that I can cross check that I
have them all against a list of folders on my laptop.
Can I somehow use list.files() - I've tried various things but none seem to
work...
Any help appreciated
Thanks Nick Wray


[[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] wrtiteBin in conjunction with seek : the position in the file is not good when writing

2024-05-21 Thread Laurent Rhelp
It works !!

Thank you VERY much because I didn't understand the rw argument for the 
seek command and endeed it is explained:

File connections can be open for both writing/appending, in which 
case*R*keeps separate positions for reading and writing. 
Which|seek|refers to can be set by its|rw|argument: the default is the 
last mode (reading or writing) which was used. Most files are only 
opened for reading or writing and so default to that state. If a file is 
open for both reading and writing but has not been used, the default is 
to give the reading position (0).

Best regards

Laurent

Le 21/05/2024 à 12:15, Ivan Krylov a écrit :
> В Tue, 21 May 2024 11:29:33 +0200
> Laurent Rhelp  пишет:
>
>> pos <- seek(con_in,2,origin="start")
>> # We have to repeat the command to return the good amount of read
>> # bytes
>> print(paste0("pos is not equal to 2, pos = ",pos))
> That's because seek() returns the previous position ("before any
> move", the one that the help page calls "current"), not the one after
> the seek. Fortunately, calling seek(origin = "start") twice with the
> same offset doesn't break anything.
>
>> # we are on position 6
>> pos <- seek(con_in,0,origin="current")
> That's strange. You started at offset 2 and read three bytes. You
> should be at offset 5 at this point. For me, seek() returns 5 here, not
> 6.
>
>> bytes = readBin(con=con_in, what="raw",n = 1)
> But after this, we should be on position 6.
>
>> writeBin(  my_string, con=con_in, useBytes = FALSE)
> It's described in help(seek) that R maintains two different pointers
> for reading and writing a file. You have been reading it, advancing the
> read pointer to 6, but the write pointer stayed at offset 0.
>
> Try seek(con_in, seek(con_in, 0, 'current', 'read'), 'start', 'write')
> to set the write pointer to the read pointer before issuing writes.
> This seems to give me the expected result.
>
[[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] wrtiteBin in conjunction with seek : the position in the file is not good when writing

2024-05-21 Thread Ivan Krylov via R-help
В Tue, 21 May 2024 11:29:33 +0200
Laurent Rhelp  пишет:

> pos <- seek(con_in,2,origin="start")
> # We have to repeat the command to return the good amount of read
> # bytes
> print(paste0("pos is not equal to 2, pos = ",pos))

That's because seek() returns the previous position ("before any
move", the one that the help page calls "current"), not the one after
the seek. Fortunately, calling seek(origin = "start") twice with the
same offset doesn't break anything.

> # we are on position 6
> pos <- seek(con_in,0,origin="current")

That's strange. You started at offset 2 and read three bytes. You
should be at offset 5 at this point. For me, seek() returns 5 here, not
6.

> bytes = readBin(con=con_in, what="raw",n = 1)

But after this, we should be on position 6.

> writeBin(  my_string, con=con_in, useBytes = FALSE)

It's described in help(seek) that R maintains two different pointers
for reading and writing a file. You have been reading it, advancing the
read pointer to 6, but the write pointer stayed at offset 0.

Try seek(con_in, seek(con_in, 0, 'current', 'read'), 'start', 'write')
to set the write pointer to the read pointer before issuing writes.
This seems to give me the expected result.

-- 
Best regards,
Ivan

__
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] wrtiteBin in conjunction with seek : the position in the file is not good when writing

2024-05-21 Thread Laurent Rhelp

Dear RHelp-list,

 I want to write at a specific position in a file without reading all 
the file
because it is very large and I cannot read it in my RAM. But I miss 
something
about the use of the command writeBin in conjunction with seek. In the 
example bellow the seek
commands works well with the readBin command but not with writeBin, the 
writeBin
command write from the beginning of the file and not from the current 
position

and however in the doculentation it is written:
  If the connection is open it is read/written from its current position.
Thank you
Best regards
Laurent


Here is the tiny example:

The file_test.txt before:
1234567890
1234567890

The file_test.txt after:
 AA AA7890
1234567890

The file should have been like that:
123456 AA AA1234567890

## open the file in read/write mode + binary
fname <- file.path(".","txt","file_test.txt")
con_in <- file(fname,"r+b")
# move on 2 bytes
pos <- seek(con_in,2,origin="start")
# We have to repeat the command to return the good amount of read bytes
print(paste0("pos is not equal to 2, pos = ",pos))
pos <- seek(con_in,2,origin="start")
print(paste0("Now pos is equal to 2, pos = ",pos))

## reading 3 characters
bytes = readBin(con=con_in, what="raw",n = 3)
my_number <- as.numeric(readBin(bytes,"character"))
print(my_number)
# we are on position 6
pos <- seek(con_in,0,origin="current")
print(paste0("pos = ",pos))
bytes = readBin(con=con_in, what="raw",n = 1)
my_number <- as.numeric(readBin(bytes,"character"))
print(my_number)
my_string <- charToRaw(sprintf(paste('%',3,'s',sep=''),"AA"))
writeBin(  my_string, con=con_in, useBytes = FALSE)
writeBin(  my_string, con=con_in, useBytes = FALSE)
close(con_in)

__
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] R-help Digest, Vol 255, Issue 17

2024-05-21 Thread Michael L Friendly
You might be interested in the `Rdatasets` package, 
https://vincentarelbundock.github.io/Rdatasets/ which lists over 2200 datasets 
from various packages.

What is the context of the `lottery` dataset. I seem to recall smth to do with 
the NJ Lottery

-Michael

   1. Availability of Sdatasets (Avro Alo)

--

Message: 1
Date: Sun, 19 May 2024 08:58:20 +
From: Avro Alo 
To: "r-help@r-project.org" 
Subject: [R] Availability of Sdatasets
Message-ID:

<8I3Bj0m1IzC35J4nEoROCf1yZD66oeLHFLtxsXKSty3vplcl5gKp-_XmdSvEbG0UYtxv8g0Jw0ihsR5x0MS0QdF7DOmooZ2C9BJVqUUlNSQ=@protonmail.com>

Content-Type: text/plain; charset="utf-8"

>From the mention in R-intro I went to look at The new S language
book. In chapter 1 it has a lottery dataset. So naturally I thought it is 
pre-supplied with R. But I didn't fount, made a google search and found the 
package that has the dataset, 
https://docs.tibco.com/pub/enterprise-runtime-for-R/6.1.1/doc/html/Language_Reference/Sdatasets/00Index.html
 

This package is very interesting on it's own. But how can I get it?

Also, shouldn't regular R installation have this too?

Thanks!

(first time posting here)




--

Subject: Digest Footer

___
R-help@r-project.org mailing list
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.


--

End of R-help Digest, Vol 255, Issue 17

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