Re: [R] Issues when trying to fit a curve when generating random deviates

2022-09-18 Thread Daniel Nordlund
On 9/18/2022 9:44 PM, Rui Barradas wrote: Hello, I cannot reproduce the error. Anyway, if the data is discrete a bar plot might be more appropriate. barplot(table(x),     col = "green",     main = "Bar plot of Binomial Distribution B(20,0.4)") Or, to have proportions, barplot(table

Re: [R] Issues when trying to fit a curve when generating random deviates

2022-09-18 Thread Rui Barradas
Hello, I cannot reproduce the error. Anyway, if the data is discrete a bar plot might be more appropriate. barplot(table(x), col = "green", main = "Bar plot of Binomial Distribution B(20,0.4)") Or, to have proportions, barplot(table(x)/length(x), etc) Hope this helps, Rui

[R] Issues when trying to fit a curve when generating random deviates

2022-09-18 Thread Paul Bernal
Dear friends, Hope you are doing great. I first generated random deviates from a binomial distribution with the following code (I had to generate from a B(20,0.4) dist): #Setting seed set.seed(1234567) #Generating 1000 random deviates from a B(20,0.4) Distribution x <- rbinom(1000,20,0.4) #Gener

Re: [R] removing non-table lines

2022-09-18 Thread avi.e.gross
Adding to what Nick said, extra lines like those described often are in some comment format like beginning with "#" or some consistent characters that can be filtered out using comment.char='#' for example in read.csv() or comment="string" in the tidyverse function read_csv(). And, of course yo

Re: [R] removing non-table lines

2022-09-18 Thread Rui Barradas
Helo, Unfortunatelly there are many files with a non tabular data section followed by the data. R's read.table has a skip argument: skip integer: the number of lines of the data file to skip before beginning to read data. If you do not know how many lines to skip because it's not always

Re: [R] removing non-table lines

2022-09-18 Thread Jeff Newmiller
Use the skip parameter if the number of header lines is always the same. On September 18, 2022 12:39:50 PM PDT, Nick Wray wrote: >Hello - I am having to download lots of rainfall and temperature data in >csv form from the UK Met Office. The data isn't a problem - it's in nice >columns and can be

Re: [R] removing non-table lines

2022-09-18 Thread CALUM POLWART
Can you provide a sample of say the first 3 rows then the last 2 rows before the CSV starts. Are there always the same number of lines at the top? Or can it vary depending what non-sense the Met Office decided to contaminate it with? This should be solvable with some sample data. Base R or Tidyv

[R] removing non-table lines

2022-09-18 Thread Nick Wray
Hello - I am having to download lots of rainfall and temperature data in csv form from the UK Met Office. The data isn't a problem - it's in nice columns and can be read into R easily - the problem is that in each csv there are 60 or so lines of information first which are not part of the columnar

Re: [R] Remove line from data file

2022-09-18 Thread CALUM POLWART
If you want to delete row 18 you can do mydf <- mydf[-18,] This selects all rows other than row 18, and all columns and 'saves' it back to the original data frame. Many people prefer to allocate to a new dataframe so that if the -18 is wrong they can simply fix things. I wasn't sure if you knew

Re: [R] Remove line from data file

2022-09-18 Thread CALUM POLWART
>From the file? Or the data frame once its loaded? What format is the file? CSV? Do you know the line that needs deleted? mydf <- read.csv("myfile.csv") mydf2 <- mydf[-columnName == "valuetodelete", ] # Note the - infront of column name # or perhaps columnName != "value to delete", ] write.csv

[R] Remove line from data file

2022-09-18 Thread Parkhurst, David
I’ve been retired since ‘06 and have forgotten most of R. Now I have a use for it. I’ve created a data file and need to delete one row from it. How do I do that? DFP (iPad) __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https:/

Re: [R] nlme gls issue

2022-09-18 Thread Lucas Heber Mariano Dos Santos
You shouldn't use use r-squared in the context of glm, in fact it's not possible. But if you need try calculating pseudo r-squared values From: R-help on behalf of Rolf Turner Sent: Saturday, September 17, 2022 12:29:56 AM To: Kayla Bazzana Cc: R-help@r-project