[R] Using multiple dat files

2024-11-06 Thread Sibylle Stöckli via R-help
Dear community To import multiple .dat weather files I am using list.files(). I intend to use the R package “ClimInd” to calculate different agroclimatic indicators. Question: Is there another solution to import multiple .dat files so that I can select elements from the list, e.g. one specifi

[R] foreSIGHT package

2024-11-02 Thread Sibylle Stöckli via R-help
Dear community I have started to use the foreSIGHT package fo calculate some climatic indicators. Example library(foreSIGHT) func_avgDSD(WAAR$Ta, attArgs) Dataset (WAAR, Ta = average daily temperature) Year DOY Ta 1990 1 -2.45 1990 2 1.54 . . 2001 1 4.54 , 2001 205 15.65 2001 206 20.14 . 2001 3

Re: [R] boxplot of raster and shapefile

2024-08-28 Thread SIBYLLE STÖCKLI via R-help
.. .. ..@ projargs: chr "+proj=somerc +lat_0=46.952405556 +lon_0=7.439583 +k_0=1 +x_0=260 +y_0=120 +ellps=bessel +units=m +no_defs" .. .. ..$ comment: chr "PROJCRS[\"unknown\",\nBASEGEOGCRS[\"unknown\",\n DATUM[\"Unknown based

[R] boxplot of raster and shapefile

2024-08-26 Thread SIBYLLE STÖCKLI via R-help
Dear community This example code works library(raster) library(sp) library(rgdal) library(ggplot2) # Create some sample raster data raster_file <- raster(ncol=36, nrow=18) raster_file[] <- 1:ncell(raster_file) plot(raster_file) #Create some sample polygons cds1 <- rbind(c(-180,-20), c(-160,5),

Re: [R] paired raster boxplots

2024-08-25 Thread SIBYLLE STÖCKLI via R-help
, when selecting the third layer it reads in number 3 (Unterregio) and number 15 (geometry). Secondly when using stack() it does not read in the s layer (probably because there are two layers). > > sf <- read_sf("C:/Users/Sibylle > Stöckli/Desktop/NCCS_Impacts_Lot2_2022/InVEST/B

Re: [R] paired raster boxplots

2024-08-24 Thread SIBYLLE STÖCKLI via R-help
quot;DEBioBedeu" "FRBioBedeu" "ITBioBedeu" [15] "geometry" > s<-sf$Unterregio > r<-allrasters_pres[[1]] Kind regards Sibylle -Original Message- From: Ivan Krylov Sent: Friday, August 23, 2024 5:30 PM To: sibylle.stoec...@gmx.ch Cc: 'SIB

Re: [R] paired raster boxplots

2024-08-23 Thread SIBYLLE STÖCKLI via R-help
ITBioBedeu" [15] "geometry" > s<-sf$Unterregio > r<-allrasters_pres[[1]] > > > rs <- stack(r, s) > names(rs) <- c('r', 's') Error in `names<-`(`*tmp*`, value = c("r", "s")) : incorrect number of layer names

[R] paired raster boxplots

2024-08-21 Thread SIBYLLE STÖCKLI via R-help
Dear community I have two raster files (here r and r2: y-axis) and an equal x-axis (here s, 4 classes). Instead of plotting two boxplots I would like to plot paired boxplots: for each class the boxplots from r and r2 paired). I tried to adapt the code, but I am struggling around with the error

Re: [R] allequal diff

2024-08-19 Thread SIBYLLE STÖCKLI via R-help
t; To sort this sort of thing out, It would probably be useful for you > > to find a tutorial on R's S3 class system (which is really a form > > of multiple dispatch) and spend some time with it. There are many > > good ones out there. This S3 system is widely use

Re: [R] allequal diff

2024-08-18 Thread SIBYLLE STÖCKLI via R-help
Message- From: Ivan Krylov Sent: Friday, August 16, 2024 11:45 AM To: sibylle.stoec...@gmx.ch Cc: 'SIBYLLE STÖCKLI via R-help' Subject: Re: [R] allequal diff В Fri, 16 Aug 2024 11:32:58 +0200 пишет: > # values and mask r1 > r1 <- getValues(r1) > mask1 <- is.na(r

Re: [R] boxplot notch

2024-08-16 Thread SIBYLLE STÖCKLI via R-help
1 20150 NA 2 20180 NA 3 20200 3.5 Code setwd("C:/Users/Sibylle Stöckli/Desktop/") #.libPaths() getwd() #libraries laden library("ggplot2") library("gridExtra") library(scales) library(nlme) library(arm) library(blme

[R] boxplot notch

2024-08-16 Thread SIBYLLE STÖCKLI via R-help
Dear community I tried the following code using geom_boxplot() and notch=TRUE. Does anyone know if the command �notch=TRUE� is at the wrong place in my special code construct? Without notch=TRUE the code provides the planned ggplot. Kind regards Sibylle Code: MS1<- MS %>% filte

Re: [R] allequal diff

2024-08-16 Thread SIBYLLE STÖCKLI via R-help
ask1 & mask2)]) [1] "'is.NA' value mismatch: 389 in current 56989152 in target" --> so there is just a mismatch in NA not in the xy pixels, right? Sibylle -Original Message- From: Ivan Krylov Sent: Friday, August 16, 2024 10:51 AM To: sibylle.stoec...@gm

Re: [R] allequal diff

2024-08-16 Thread SIBYLLE STÖCKLI via R-help
Here my idea including the error: > m1=r1[r1="NA",] > m2=r2_resampled[r2_resampled="NA",] > > > all.equal(getValues(r1)[!m1], getValues(r2_resampled)[!m2]) [1] "Numeric: lengths (80706867, 65806339) differ" -Original Message----- From

Re: [R] allequal diff

2024-08-16 Thread SIBYLLE STÖCKLI via R-help
LLE STÖCKLI via R-help Cc: sibylle.stoec...@gmx.ch Subject: Re: [R] allequal diff В Fri, 16 Aug 2024 07:19:38 +0200 SIBYLLE STÖCKLI via R-help пишет: > Is it possible to consider na.rm=TRUE? > > all.equal(getValues(r1), getValues(r2_resampled), tolerance = 0) > > [1] "

Re: [R] allequal diff

2024-08-15 Thread SIBYLLE STÖCKLI via R-help
internally for doing the comparison for large rasters a block at a time if everything can't fit in memory at the same time ... On 2024-08-15 9:14 a.m., SIBYLLE STÖCKLI via R-help wrote: > Dear community > > > > Similar to the example of the rdocumentation

[R] allequal diff

2024-08-15 Thread SIBYLLE STÖCKLI via R-help
Dear community Similar to the example of the rdocumentation, my idea is to use all.equal and to print the difference. https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/all.equal > d45 <- pi*(1/4 + 1:10) > stopifnot( + all.equal(tan(d45), rep(1, 10))) # TRUE, b

[R] geom_boxplot nocht=TRUE

2024-08-15 Thread SIBYLLE STÖCKLI via R-help
Dear community I tried to run my ggplot() +geom_boxplot() code using nocht=TRUE, but probably my term noch=TRUE is at the wrong position? Error: Error in `geom_boxplot()`: ! Problem while converting geom to grob. ℹ Error occurred in the 1st layer. Caused by error in `ans[ypos] <- rep(y

Re: [R] geom_smooth with sd

2024-08-11 Thread SIBYLLE STÖCKLI via R-help
lay a part, please? Thank you Erin Hodgess, PhD mailto: erinm.hodg...@gmail.com <mailto:erinm.hodg...@gmail.com> On Sun, Aug 11, 2024 at 10:10 AM SIBYLLE STÖCKLI via R-help mailto:r-help@r-project.org> > wrote: Dear community Using after_stat() I was able to v

[R] geom_smooth with sd

2024-08-11 Thread SIBYLLE STÖCKLI via R-help
Dear community Using after_stat() I was able to visualise ggplot with standard deviations instead of a confidence interval as seen in the R help. p1<-ggplot(data = MS1, aes(x= Jahr, y= QI_A,color=Bio, linetype=Bio)) + geom_smooth(aes(fill=Bio, ymax=after_stat(y+se*sqrt(len

Re: [R] ggplot two-factor legend

2024-07-18 Thread SIBYLLE STÖCKLI via R-help
/07/2024, Rui Barradas escreveu: > Às 16:27 de 18/07/2024, SIBYLLE STÖCKLI via R-help escreveu: >> Hi >> >> I am using ggplot to visualise y for a two-factorial group (Bio: 0 >> and >> 1) x >> = 6 years. I was able to adapt the colour of the lines (green a

Re: [R] ggplot two-factor legend

2024-07-18 Thread SIBYLLE STÖCKLI via R-help
uld like the additionally differentiate the two lines (groups) in the linetype. Sibylle -Original Message- From: Jeff Newmiller Sent: Thursday, July 18, 2024 6:13 PM To: sibylle.stoec...@gmx.ch; SIBYLLE STÖCKLI via R-help ; r-help@r-project.org Subject: Re: [R] ggplot two-factor

[R] ggplot two-factor legend

2024-07-18 Thread SIBYLLE STÖCKLI via R-help
Hi I am using ggplot to visualise y for a two-factorial group (Bio: 0 and 1) x = 6 years. I was able to adapt the colour of the lines (green and red) and the linetype (solid and dashed). Challenge: my code produces now two legends. One with the colors for the group and one with the linetype for th

Re: [R] Import multiple tif raster

2024-04-18 Thread SIBYLLE STÖCKLI via R-help
Dear community Dear Ivan Thanks a lot. The code works now. Solution: direct and full path to the .tif files. I confused back and forward slash #first import all files in a single folder as a list rastlist <- list.files(path = "C:/Users/Sibylle Stöckli/Desktop/NCCS_Impacts_Lot2_202

Re: [R] Import multiple tif raster

2024-04-18 Thread SIBYLLE STÖCKLI via R-help
Dear Ivan Thanks a lot. I tried now to provide the full path. However probably the "ö" in the path produces the error, would that be possible? > #first import all files in a single folder as a list > rastlist <- list.files(path = "C:\Users\Sibylle > Stöckli\Des

[R] Import multiple tif raster

2024-04-18 Thread SIBYLLE STÖCKLI via R-help
lllrasters: is list() ok or should there be a number (the number of imported .tif files? Kind regards Sibylle > library(terra) > library(raster) > getwd() [1] "C:/Users/Sibylle Stöckli/Desktop" > > #first import all files in a single folder as a list > rastlist <- l

Re: [R] geom_edge & color

2024-03-24 Thread SIBYLLE STÖCKLI via R-help
"color", > > value = c(viridis::viridis(21)) > > [match(E(.)$type, c(factor(V(.)$name)))]) %>% > > set_vertex_attr(name = "trans_v_net", value = c(transitivity(., type > = > "local"))) %>% > >

Re: [R] geom_edge & color

2024-03-22 Thread SIBYLLE STÖCKLI via R-help
+ scale_edge_width(range = c(0.2,4))+ scale_size(range = c(0.5,15)) + theme(plot.background = element_rect(fill = "black"), legend.position = "right", panel.background = element_rect(fill = "black")) dev.off() -Original Message---

[R] geom_edge & color

2024-03-20 Thread SIBYLLE STÖCKLI via R-help
Dear community I am using ggraph to plot a network analysis. See part 2 in the working example. Besides different colors for different groups of nodes: --> geom_node_point(aes(size = V(network)$hub_score*200, color= as.factor(V(network)$community))) I additionally want to consider different colors

Re: [R] igraph_vertex

2024-02-26 Thread SIBYLLE STÖCKLI via R-help
lt layout > dev.off() TIFFOpen: figures/AES_network_bymembership.tiff: Cannot open. RStudioGD 2 Warning message: In dev.off() : unable to open TIFF file 'figures/AES_network_bymembership.tiff' Kind regards Sibylle -Original Message- From: Ivan Krylov Sent: Monday, Feb

Re: [R] igraph_vertex

2024-02-26 Thread SIBYLLE STÖCKLI via R-help
Dear Kimmo First of all many thanks for the valuable advice to publish code and csv. Noted. Yes, "edge.width= E(.)$weight" makes definitively sense. In the following code, which loads the tiff file, I get the following error tiff("figures/AES_network_bymembership.tiff", width=1000, height=700,

Re: [R] igraph_vertex

2024-02-25 Thread SIBYLLE STÖCKLI via R-help
Dear coummunity Thanks a lot to David and Kimmo. Yes I see now that I need to provide the two raw tables. Find here the reproducible example. Kind regards Sibylle # R-labraries library(circlize) library(ggplot2) library(igraph) library(tidyverse) library(RColorBrewer) library(stringi) library(s

Re: [R] igraph_vertex

2024-02-24 Thread SIBYLLE STÖCKLI via R-help
Dear R-community It would be nice to get some input how to find a solution for the following error in igraph and vertex setting. Error in intI(i, n = x@Dim[1], dn[[1]], give.dn = FALSE) : Index größer als maximales 6 Kind regards Sibylle Working example library(circlize) library(ggplot2)

[R] igraph_vertex

2024-02-24 Thread SIBYLLE STÖCKLI via R-help
Dear R-community It would be nice to get some input how to find a solution for the following error in igraph and vertex setting. Thank you very much Sibylle > par(bg="black") > network %>% plot( + vertex.color=clrs[V(.)$community], + vertex.size=V(.)$hub_score*1, + ve

Re: [R] ggarrange & legend

2024-02-05 Thread SIBYLLE STÖCKLI via R-help
uot;black"), ncol=2) fig1 Kind regards Sibylle From: John Kane Sent: Monday, February 5, 2024 1:59 PM To: sibylle.stoec...@gmx.ch Cc: r-help@r-project.org Subject: Re: [R] ggarrange & legend Could you supply us with a MWE (minimal working example)of what you have so far?

[R] ggarrange & legend

2024-02-05 Thread SIBYLLE STÖCKLI via R-help
Dear R community It is possible to adjust the legend in combined ggplots using ggarrange with be positions top, bottom, left and right. My question: Is there a function to change the position of the legend to topright or bottomleft? Right and top etc are in the middle of the axis. Kind regards Si

Re: [R] ggplot 3-dimensions

2023-12-17 Thread SIBYLLE STÖCKLI via R-help
e angel of the x-axis. However, I was able to change the first x-axis (BB...), but not the second one (Voegel). Maybe this would solve the problem. - If not, is there another possibility to fix the number of subplots per line? Kind regards Sibylle -Original Message- From: R-help On Beha

Re: [R] barplot_add=TRUE

2018-01-09 Thread Sibylle Stöckli
m$trapcatch, w$trapcatch)) > > do what you want (modulo layout details)? > > Hth -- Gerrit > > - > Dr. Gerrit Eichner Mathematical Institute, Room 212 > gerrit.eich...@math.uni-giesse

[R] barplot_add=TRUE

2018-01-09 Thread Sibylle Stöckli
Dear R users aim Barplot of insect trap catches (y variable trapcatch) at one specific station (variable FiBL_Hecke) from week 1-52 ( x variable week). It works well using the function tapply (sum trapcatch per week, males and females not separated), however, I intend to separate the y variable

[R] vegan NMDS labels

2016-12-09 Thread Sibylle Stöckli
Dear R users Does anybody know how it may be possible to plot the labels of a ordihull function separately (in R vegan)? We have studied the bee community in 5 different habitat types. As you see from the code, we use different point types (pch) and line types (lty). This is only possible if we

[R] glmer and glht

2016-08-15 Thread Sibylle Stöckli
Dear R colleagues, The effect of habitat type on bee species number was tested using a glmer model with habitat as fixed effect (5 habitat types) and site and time as random terms. The idea was now to conduct post hoc tests with glht (package "multcomp") for pairwise comparisons. The matrix was

[R] NCDF_arrays

2015-08-03 Thread Sibylle Stöckli
Dear R-users I am working with ncdf data using the variables time (1-365), lon (longitude), lat (latitude) and the Temperature variable daily). After setting the parameters for the model, I am able to calculate the output for each lon-lat grid point. The model works well including one ncdf fil

[R] Vegan_p-values_RDA

2015-06-04 Thread Sibylle Stöckli
Dear R members, I understand the main principles why R-Vegan does not provide p-values for the biplot scores and/or canonical coefficients (see also post on stackoverflow). (i) We can obtain linear regression statistics and refit an ordination result as multiple response linear model (lm, see a

[R] Vegan pca and cor

2014-06-12 Thread Sibylle Stöckli
Dear R colleagues, I applied a pca to 130 farms (sites) and 25 variables (species) using the R package vegan. Besides analyzing the variation explained by the different pca axes and the variables the pca axis are correlated with, I am also interested to analyze the correlation between the varia

Re: [R] varpart

2013-08-27 Thread Sibylle Stöckli
Thanks a lot Sibylle On 23.08.2013, at 11:06, Jari Oksanen wrote: Sibylle Stöckli gmx.ch> writes: I applied vegan's varpart function to partition the effects of explanatory matrices. Adj. R square for the unique fraction [a] is 0.25. Does anyone know why the decomposition by hand

[R] varpart

2013-08-22 Thread Sibylle Stöckli
Dear R-users I applied vegan's varpart function to partition the effects of explanatory matrices. Adj. R square for the unique fraction [a] is 0.25. Does anyone know why the decomposition by hand using rda gives me a different result for [a] (constrained proportion is 0.32)? I used cbind()

[R] lme (weights) and glht

2013-07-25 Thread Sibylle Stöckli
Dear R members, I tried to fit an lme model and to use the glht function of multcomp. However, the glht function gives me some errors when using weights=varPower(). The glht error makes sense as glht needs factor levels and the model works fine without weights=. Does anyone know a solution s

[R] vegan rda na adaptation

2011-09-23 Thread Sibylle Stöckli
Dear R users, I know, the topic is more related to the r-sig-ecology. I decided to post it to the r-help as some specific topics of my question deals with NA-values and RDA (R vegan) and an adaptated RDA code due to a specific study design (including a second matrix). I am calculating a RDA

[R] lme weights glht

2010-11-17 Thread Sibylle Stöckli
Dear R-user I used lme to fit a linear mixed model inlcuding weights=varPower(). Additionally I wanted to use glht to calculate Tukey-Kramer multiple comparision. error: > glht(modelF, linfct=mcp(Species="Tukey")) Error in glht.matrix(model = list(modelStruct = list(reStruct = list(SubPl

[R] anova(lme.model)

2010-11-06 Thread Sibylle Stöckli
Dear R users Topic: Linear effect model fitting using the nlme package (recomended by Pinheiro et al. 2008 for unbalanced data set). The R help provides much info about the controversy to use the anova(lme.model) function to present numerator df and F values. Additionally different p-values ca

[R] make many barplot into one plot

2010-10-30 Thread Sibylle Stöckli
Dear R users I would like to group my barplot graph (see example on the R help link). The proposed R code, adding individual bars to the plot, looks really overwhelming. My specific dataset just consists of five groups and three different levels within each groups (the individual bars). T

[R] make many barplot into one plot

2010-10-29 Thread Sibylle Stöckli
Dear R users I would like to group my barplot graph (see example on the R help link). The proposed R code, adding individual bars to the plot, looks really overwhelming. My specific dataset just consists of five groups and three different levels within each groups (the individual bars). The .t

Re: [R] Fwd: as.list

2010-10-27 Thread Sibylle Stöckli
PA$Site=="KA" & PA$part=="NE", ] ## the last comma is important to select all the columns for the rows you've chosen Read ?"[" or ?subset to understand more The barplot() might work better then. HTH, Ivan Le 10/27/2010 15:09, "Sibylle Stöckli" a

[R] as.list rcode

2010-10-27 Thread Sibylle Stöckli
Original-Nachricht Datum: Wed, 27 Oct 2010 15:09:59 +0200 Von: "Sibylle Stöckli" An: Rhelp Betreff: Fwd: as.list Original-Nachricht Datum: Wed, 27 Oct 2010 15:03:48 +0200 Von: "Sibylle Stöckli" An: Rhelp Betreff: as.list Dear R-user

[R] Fwd: as.list

2010-10-27 Thread Sibylle Stöckli
Original-Nachricht Datum: Wed, 27 Oct 2010 15:03:48 +0200 Von: "Sibylle Stöckli" An: Rhelp Betreff: as.list Dear R-users sorry, here Rcode included (attachment has been removed) I would like to read a txt file as list, to select rows and columns, and to create bar

[R] as.list

2010-10-27 Thread Sibylle Stöckli
Dear R-users I would like to read a txt file as list, to select rows and columns, and to create barplots. (1) selection of parameter site and part: ok (2) read txt file as list: problem with (1) as there are NA's (the lines not selected) (3) barplot: 5 different groups of bars (the selected co

[R] boxplot ranked x labels

2010-10-18 Thread Sibylle Stöckli
Dear R users, x-values (EI) = Adw, EG1, LA1, Ad1, LA2, LA3...(14 levels, insect stages) y-valus = antpop within the boxplot function x-values are ordered alphabetically Idea: x-values ranked by list order (insect stage: Egg stage 1 is followed by Larvae 1 and not by Egg stage 2 as it would

[R] dnorm

2010-09-23 Thread Sibylle Stöckli
Dear R-users Idea: Plot a dnorm line using specific mean/sd to complete a histogram (skewed). xs:range of y-values, ys: dnorm function Problem: I expected to multiply the ys function with the sample size (n=250-300). I was wondering about a factor between 12'000 and 30'000 to match the size of

[R] kstest vs shapirotest

2010-09-22 Thread Sibylle Stöckli
Dear R-users Idea: Analysing tree height frequency with hist(), normal distribution (ks.test & shapiro.test) and skewness (package e1071 - thanks a lot for this useful package)as an indication of possible self-thinning in an experimental tree stand. Problem: Results from the ks.test and the